Skip to content

[Bug] r.patch fails if one input is a GRASS vrt and nprocs > 1 #6616

@metzm

Description

@metzm

Describe the bug

It seems there is a race condition with parallelised r.patch in G85 if one input is a GRASS vrt consisting of many files, the error is "Invalid descriptor: X" coming from https://github.com/OSGeo/grass/blob/main/lib/raster/close.c#L104. It works with nprocs=1. In a GRASS vrt, the source raster maps are opened and closed on demand in order to avoid issues like in #6615.

To reproduce

  1. Create a GRASS vrt with r.buildvrt consisting of a large number of files
  2. Use a fast CPU with at least 6 cores (not threads but real cores)
  3. Patch the GRASS vrt with another raster map using the max number of available threads

Solution

For parallelisation, some sort of file open/close lock needs to be implemented in /lib/raster

System description

G85

Additional context

Attempting to patch the results of AI models for semantic segmentation which require small input tiles of typically the size 256x256 pixels to 512x512 pixels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions