[GRASS-dev] [GRASS GIS] #537: g.proj.exe crashes on Windows Vista (osgeo4w)

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
---------------------------------+------------------------------------------
Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Keywords: osgeo4w g.proj gdal | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------+------------------------------------------
g.proj.exe crashes on Windows Vista. It can be reproduced simply launching
g.prog -w

The crash seems to be related to system32/ntdll.dll, as I can see from the
Windows error log. Maybe problems with gdal15.dll and ntdll.dll?

Recompiling grass-6.4.0RC3 from scratch, using gdal and all the
dependencies built with MinGW, solves it so it seems a problem related to
the actual OSGeo4W stack

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by giohappy):

In many forums I see similar problems with ntdll.dll, for various apps.
One interesting explanation could be the following:

ntdll is the user-mode entry into system services (that's "system calls"
not process-based services). If a buggy app passes an invalid address to
some ntdll entry point, the resulting exception will likely show an
address in ntdll.
you might see similar problems in many apps - there are many buggy apps
out there.

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by giohappy):

I've run gdb to debug the crash (without -g on build). This is the
traceback:

(gdb) run -w
Starting program: c:\OSGeo4W\apps\grass\grass-6.5.svn\bin/g.proj.exe -w
[New thread 2856.0x364]

Program received signal SIGTRAP, Trace/breakpoint trap.
0x77d47dff in ntdll!DbgUiConvertStateChangeStructure ()
    from C:\Windows\system32\ntdll.dll
(gdb) warning: Lowest section in C:\Windows\system32\odbcint.dll is .rsrc
at 00401000
warning: Invalid parameter passed to C runtime function.

warning: HEAP[g.proj.exe]:
warning: Invalid address specified to RtlFreeHeap( 01430000, 015E4700 )

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by jef):

Replying to [comment:2 giohappy]:
> I've run gdb to debug the crash (without -g on build). This is the
traceback:
>
> (gdb) run -w
> Starting program: c:\OSGeo4W\apps\grass\grass-6.5.svn\bin/g.proj.exe -w
> [New thread 2856.0x364]
>
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x77d47dff in ntdll!DbgUiConvertStateChangeStructure ()
> from C:\Windows\system32\ntdll.dll
> (gdb) warning: Lowest section in C:\Windows\system32\odbcint.dll is
.rsrc at 00401000
> warning: Invalid parameter passed to C runtime function.
>
> warning: HEAP[g.proj.exe]:
> warning: Invalid address specified to RtlFreeHeap( 01430000, 015E4700 )

Please try the attached patch.

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: fixed | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Changes (by giohappy):

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

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Changes (by neteler):

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

Comment:

giohappy: how was it fixed? In GRASS?

Markus

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by giohappy):

I'm sorry. I missed the explanation. It has been PARTLY solved with the
attached patches my Jef. It's a problem with memory release.
I would keep it open because other tests reveal a strange problem. While
the creation of projections has been solved, the proj output as wkt still
causes a crash for certain projections. It works fine if I use a loc,
i.e., from epsg 3004, while it crashed with epsg 4326 or epsg 32632.
I will investigate more.

I hope this kind of memory deallocation problems don't propagate to other
parts of Grass!

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by giohappy):

I attach the complete patch that solves the problems listed.

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by pkelly):

I've committed patches for this similar to Jef's in releasebranch_6_4,
develbranch_6 and trunk. I had a look through the same source file and
couldn't see any immediately obvious similar bugs. Thanks for the help
tracking this down. The bugs were all originally introduced by me...

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by neteler):

For the record: r36484 (trunk), r36483 (6.5) and r36482 (6.4)

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: fixed | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Changes (by giohappy):

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

Comment:

Perfect! Just tested.

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

#537: g.proj.exe crashes on Windows Vista (osgeo4w)
------------------------------+---------------------------------------------
  Reporter: giohappy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: fixed | Keywords: osgeo4w g.proj gdal
  Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by daudeoud):

I find the same Vista g.proj crash problem on Grass 6.4.0, Qgis 1.0.2 and
1.3 with the OSGeo4W package. Is there a solution without recompiling the
package ?

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