[GRASS-git] [OSGeo/grass] 71c8a1: libpython: Avoid race condition when reading regio...

Vaclav Petras noreply at github.com
Sun May 17 20:20:41 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/OSGeo/grass
  Commit: 71c8a1f1d011c567eeca686d00a5f2ada4a8ac46
      https://github.com/OSGeo/grass/commit/71c8a1f1d011c567eeca686d00a5f2ada4a8ac46
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2020-05-17 (Sun, 17 May 2020)

  Changed paths:
    M lib/python/script/core.py
    A lib/python/script/testsuite/data/script_using_temporary_region.py
    A lib/python/script/testsuite/test_parallel_temp_region.sh

  Log Message:
  -----------
  libpython: Avoid race condition when reading region in use_temp_region() (#638)

When g.region is called without -u flag, it always adjusts and writes back the
computational region. When a parallel process is reading it too, it hits an empty
(or rarely corrupted) file. region() and other region functions in core.py are already using it.

In the provided test, this happens when reading the WIND file. In the test, return codes
of background processes are not propagated (in Bash), so raster maps are created to track processes. These are created at the end of each Python script run.
The Bash script is parametrized to make it reusable also for a potential nesting region correctness test.

See also:
https://trac.osgeo.org/grass/ticket/2230 'g.region -p' writes new WIND file...
#250 r.import: ...WIND file disappears...
#630 unpredictable errors in the results with temp region (nesting suspected)




More information about the grass-commit mailing list