[GRASS-dev] [GRASS GIS] #1710: Segfault in r.proj

#1710: Segfault in r.proj
---------------------+------------------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: | Platform: Linux
      Cpu: x86-64 |
---------------------+------------------------------------------------------
I have found a reproducible but irregular appearing segfault in r.proj
when using several threads. Looks like an OpenMP race condition?
This error is not reproducible with OMP_NUM_THREADS=1.

Here the gdb output and backtrace
{{{
GRASS 7.0.svn (ECAD):~/Geostat > gdb r.proj
(gdb) r input=g250_06 location="Corine LAEA ETRS89" mapset=PERMANENT --o

Input:
Cols: 23600 (23600)
Rows: 18400 (18400)
North: 5500000.000000 (5500000.000000)
South: 900000.000000 (900000.000000)
West: 1500000.000000 (1500000.000000)
East: 7400000.000000 (7400000.000000)
EW-res: 250.000000
NS-res: 250.000000

Output:
Cols: 23600 (23600)
Rows: 18400 (18400)
North: 58.952751 (58.952751)
South: 26.415806 (26.415806)
West: -18.236960 (-18.236960)
East: 72.906137 (72.906137)
EW-res: 0.003862
NS-res: 0.001768

Allocating memory and reading input map...
  100%
Projecting...
[New Thread 0x7fffeb099700 (LWP 18304)]
[New Thread 0x7fffea898700 (LWP 18305)]
[New Thread 0x7fffea097700 (LWP 18306)]
   27%
Program received signal SIGSEGV, Segmentation fault.
0x0000000000402bae in p_nearest (ibuffer=0x60daf0, obufptr=0x655c5c,
cell_type=0, col_idx=4619.2086762076688, row_idx=8957.466116201218,
cellhd=0x7fffffffd550) at nearest.c:33
33 cell = CVAL(ibuffer, row, col);
(gdb) bt
#0 0x0000000000402bae in p_nearest (ibuffer=0x60daf0, obufptr=0x655c5c,
cell_type=0, col_idx=4619.2086762076688, row_idx=8957.466116201218,
cellhd=0x7fffffffd550) at nearest.c:33
#1 0x00000000004050f2 in main.omp_fn.0 (.omp_data_i=0x7fffffffd8c0) at
main.c:517
#2 0x0000000000404b31 in main (argc=5, argv=0x7fffffffdb68) at main.c:496

}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1710&gt;
GRASS GIS <http://grass.osgeo.org>

#1710: Segfault in r.proj
----------------------------+-----------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.proj, openmp | Platform: Linux
      Cpu: x86-64 |
----------------------------+-----------------------------------------------
Changes (by martinl):

  * keywords: => r.proj, openmp

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1710#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1710: Segfault in r.proj
----------------------------+-----------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.proj, openmp | Platform: Linux
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by mmetz):

Replying to [ticket:1710 huhabla]:
> I have found a reproducible but irregular appearing segfault in r.proj
when using several threads. Looks like an OpenMP race condition?
> This error is not reproducible with OMP_NUM_THREADS=1.

I have disabled parallelization in r52882. It worked in my tests, but that
was apparently pure luck. Maybe a separate cache for each thread is
needed.

Markus M

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1710#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1710: Segfault in r.proj
----------------------------+-----------------------------------------------
Reporter: huhabla | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.proj, openmp | Platform: Linux
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by martinl):

Can we close this ticket than?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1710#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1710: Segfault in r.proj
----------------------+-----------------------------------------------------
  Reporter: huhabla | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: major | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.proj, openmp
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Changes (by neteler):

  * status: new => closed
  * resolution: => fixed

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1710#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>