[GRASS-dev] [GRASS GIS] #3915: wxGUI: crash with ValueError: list.remove(x): x not in list

#3915: wxGUI: crash with ValueError: list.remove(x): x not in list
----------------------------+-------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.8.1
Component: wxGUI | Version: svn-trunk
Keywords: python3, g.gui | CPU: Unspecified
Platform: Unspecified |
----------------------------+-------------------------
At time, on Fedora 29, both G78 and master fail to start the GUI (after
`make distclean` and recompile):

{{{
g.gui
Traceback (most recent call last):
   File "/home/mundialis/software/grass_master/dist.x86_64-pc-linux-
gnu/gui/wxpython/wxgui.py", line 106, in OnInit
     workspace=self.workspaceFile)
   File "/home/mundialis/software/grass_master/dist.x86_64-pc-linux-
gnu/gui/wxpython/lmgr/frame.py", line 143, in __init__
     self.notebook = self._createNoteBook()
   File "/home/mundialis/software/grass_master/dist.x86_64-pc-linux-
gnu/gui/wxpython/lmgr/frame.py", line 338, in _createNoteBook
     gcstyle=GC_PROMPT)
   File "/home/mundialis/software/grass_master/dist.x86_64-pc-linux-
gnu/gui/wxpython/gui_core/goutput.py", line 118, in __init__
     self.cmdPrompt = GPromptSTC(parent=self, menuModel=self._menuModel)
   File "/home/mundialis/software/grass_master/dist.x86_64-pc-linux-
gnu/gui/wxpython/gui_core/prompt.py", line 138, in __init__
     GPrompt.__init__(self, parent=parent, menuModel=menuModel)
   File "/home/mundialis/software/grass_master/dist.x86_64-pc-linux-
gnu/gui/wxpython/gui_core/prompt.py", line 57, in __init__
     self.mapsetList = utils.ListOfMapsets()
   File "/home/mundialis/software/grass_master/dist.x86_64-pc-linux-
gnu/gui/wxpython/core/utils.py", line 308, in ListOfMapsets
     mapsets.remove(mapset)
ValueError: list.remove(x): x not in list
OnInit returned false, exiting...
Error in atexit._run_exitfuncs:
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this"
failed at ../src/common/wincmn.cpp(478) in ~wxWindowBase(): any pushed
event handlers must have been removed

g.mapsets -p
Accessible mapsets:
ortsteil_1 PERMANENT

g.version -rge
version=7.9.dev
date=2019
revision=69bd92a94
build_date=2019-10-03
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=00000
libgis_date="?"
proj=4.9.3
gdal=2.3.2
geos=3.6.1
sqlite=3.26.0
}}}

Not sure what causes this (on Fedora 30 no such problem)...

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

#3915: wxGUI: crash with ValueError: list.remove(x): x not in list
--------------------------+----------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.1
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: python3, g.gui
       CPU: Unspecified | Platform: Unspecified
--------------------------+----------------------------

Comment (by annakrat):

Does this happen in any location? What does g.mapsets -l return? I don't
see anything problematic and it works here, so you would have to
investigate what it is trying to remove in core/utils.py L308.

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

#3915: wxGUI: crash with ValueError: list.remove(x): x not in list
--------------------------+----------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.1
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: python3, g.gui
       CPU: Unspecified | Platform: Unspecified
--------------------------+----------------------------

Comment (by neteler):

Replying to [comment:1 annakrat]:
> Does this happen in any location?

No, see below.

> What does g.mapsets -l return?

It returns a list of mapsets, all exist.

> I don't see anything problematic and it works here, so you would have to
investigate what it is trying to remove in core/utils.py L308.

Ok, this helped to debug the problem:

The actual mapset lacks the `WIND` file:

{{{
g.region -p
ERROR: Unable to open element file <> for <WIND@ortsteil_1>
}}}

I have no clue how this happened but I thought we had an "auto-repair" in
place somewhere (like we do for the `sqlite/` subdir).

A possibility might be to catch such an error (earlier) and reject to
start GRASS with a broken mapset.

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

#3915: wxGUI: crash with ValueError: list.remove(x): x not in list
--------------------------+----------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.1
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: python3, g.gui
       CPU: Unspecified | Platform: Unspecified
--------------------------+----------------------------

Comment (by neteler):

We may consider this "wontfix" since broken mapsets very rarely occur...

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

#3915: wxGUI: crash with ValueError: list.remove(x): x not in list
--------------------------+----------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.1
Component: wxGUI | Version: svn-trunk
Resolution: wontfix | Keywords: python3, g.gui
       CPU: Unspecified | Platform: Unspecified
--------------------------+----------------------------
Changes (by annakrat):

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

Comment:

Reopen if needed.

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