[GRASS-dev] [GRASS GIS] #3487: vector digitizer unstable

GRASS GIS trac at osgeo.org
Mon Mar 23 04:19:39 PDT 2020


#3487: vector digitizer unstable
------------------------+-------------------------------
  Reporter:  cmbarton   |      Owner:  grass-dev@…
      Type:  defect     |     Status:  new
  Priority:  critical   |  Milestone:  7.8.3
 Component:  wxGUI      |    Version:  7.2.2
Resolution:             |   Keywords:  digitizer, ctypes
       CPU:  OSX/Intel  |   Platform:  MacOSX
------------------------+-------------------------------

Comment (by nila):

 I have been able to track the origin of the problem. It is python ctypes
 related.

 {{{
 (lldb) bt
 * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
 (code=1, address=0x100000019)
   * frame #0: 0x000000010d4ca8f2
 Python`_PyObject_IsFreed(op=0x0000000100000001) at object.c:423:56
     frame #1: 0x000000010d4caa42
 Python`_PyObject_Dump(op=0x0000000100000001) at object.c:450:9
     frame #2: 0x000000010d4ced5a
 Python`_Py_ForgetReference(op=0x0000000124b5c970) at object.c:1950:9
     frame #3: 0x000000010d4c95d5 Python`_Py_Dealloc(op=0x0000000124b5c970)
 at object.c:1973:5
     frame #4: 0x00000001175a8605 _ctypes.cpython-37dm-
 darwin.so`_ctypes_callproc(pProc=(libgrass_vector.7.9.dylib`Vect_open_update
 at open.c:641), argtuple=0x0000000115e64960, flags=4353,
 argtypes=0x0000000120895ce0, restype=0x00007fcd62120e40,
 checker=0x0000000000000000) at callproc.c:1226:9
     frame #5: 0x0000000117598f23 _ctypes.cpython-37dm-
 darwin.so`PyCFuncPtr_call(self=0x0000000120893560,
 inargs=0x0000000115e64960, kwds=0x0000000000000000) at _ctypes.c:4025:14
     frame #6: 0x000000010d44763a
 Python`_PyObject_FastCallKeywords(callable=0x0000000120893560,
 stack=0x00007fcd64629840, nargs=3, kwnames=0x0000000000000000) at
 call.c:199:18
 }}}

 The call (starting from
 [https://github.com/OSGeo/grass/blob/c33bb5ecd4fe52f6406ae4ddffd316d80435f6fb/gui/wxpython/vdigit/wxdisplay.py#L1021
 wxdisplay.py#L1021]) to GRASS c code function `Vect_open_update()` returns
 successfully, but ctypes' `_ctypes_callproc()` internal cleanup at
 [https://github.com/python/cpython/blob/d7c567b08f9d7d6aef21b881340a2b72731129db/Modules/_ctypes/callproc.c#L1226
 callproc.c#L1226] hits bad memory access.

 I'm not sure yet whether the issue is fixable within GRASS or if it has to
 be dealt with upstreams.

 Sidenote: I made a python script calling only the relevant code without
 the gui with the same result (segfault), this eliminates the possibility
 of event (binding) related effects.

 Additionally, the reported issue on "Expecting 825x586 image but got
 825x622 image." [https://trac.osgeo.org/grass/ticket/3487#comment:19
 comment:19] is an equally critical but a separate one to the originally
 reported issue. The following seems to fix this latter issue (but I'd wait
 to PR this before a solution for both of them can be presented):

 {{{
 diff --git a/gui/wxpython/mapdisp/toolbars.py
 b/gui/wxpython/mapdisp/toolbars.py
 index e8b08ad79..9bce3a0ef 100644
 --- a/gui/wxpython/mapdisp/toolbars.py
 +++ b/gui/wxpython/mapdisp/toolbars.py
 @@ -233,6 +233,7 @@ class MapToolbar(BaseToolbar):
          """Select / enable tool available in tools list
          """
          tool = event.GetSelection()
 +        self.parent.mapWindowProperties.autoRender = False

          if tool == self.toolId['2d']:
              self.ExitToolbars()
 @@ -253,6 +254,8 @@ class MapToolbar(BaseToolbar):
              self.ExitToolbars()
              self.parent.AddRDigit()

 +        self.parent.mapWindowProperties.autoRender = True
 +
      def OnAnalyze(self, event):
          """Analysis tools menu
          """
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3487#comment:24>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list