grass-svn2git / grass-issues-test

0 stars 0 forks source link

GRASS GIS fails to start without terminal #20

Open grass-svn2git opened 5 years ago

grass-svn2git commented 5 years ago

Reported by @wenzeslaus on 20 Feb 2017 21:06 UTC On Ubuntu (16.04):

In 7.2 you get error about g.extension (https://trac.osgeo.org/grass/ticket/3253) and trunk you don't get anything (it fails later on).

It is reproducible with nohup:

nohup grass

Using less nohup.out you can get the output which mainly reveals:

ERROR: Variable 'LOCATION_NAME' not set

followed by

Traceback (most recent call last):
  File "/usr/lib/grass72/gui/wxpython/wxgui.py", line 158, in <module>
    sys.exit(main())
  File "/usr/lib/grass72/gui/wxpython/wxgui.py", line 145, in main
    app = GMApp(workspaceFile)
  File "/usr/lib/grass72/gui/wxpython/wxgui.py", line 48, in __init__
...
grass.exceptions.CalledModuleError: [it depends]
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
PyAssertionError: C++ assertion "GetEventHandler() == this" failed at ../src/common/wincmn.cpp(478) in ~wxWindowBase(): any pushed event handlers must have been removed
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
wx._core.PyAssertionError: C++ assertion "GetEventHandler() == this" failed at ../src/common/wincmn.cpp(478) in ~wxWindowBase(): any pushed event handlers must have been removed

Workaround which assumes you have some default mapset already:

grass --exec g.gui

Answer to the "What did you expect to happen?" question:

Other possible improvements:

Migrated-From: https://trac.osgeo.org/grass/ticket/3295

grass-svn2git commented 5 years ago

Comment by @wenzeslaus on 20 Feb 2017 22:10 UTC From the nohup case I get the following in the output (as expected, I suppose):

/bin/bash: error reading input file: Bad file descriptor
WARNING: Failed to start shell '/bin/bash'

With the following patch, nohup case actually runs.

Index: grass.py
## ===============================================================
--- grass.py    (revision 70649)
+++ grass.py    (working copy)
@@ -1386,7 +1386,8 @@

     # Check for gui interface
     if grass_gui == "wxpython":
-        Popen([os.getenv('GRASS_PYTHON'), wxpath("wxgui.py")])
+        return Popen([os.getenv('GRASS_PYTHON'), wxpath("wxgui.py")])
+    return None

 def close_gui():
@@ -1961,7 +1962,7 @@
                                             mapset_settings.location)

         # start GUI and register shell PID in rc file
-        start_gui(grass_gui)
+        gui_process = start_gui(grass_gui)
         kv = read_gisrc(gisrc)
         kv['PID'] = str(shell_process.pid)
         write_gisrc(kv, gisrc)
@@ -1968,6 +1969,13 @@
         exit_val = shell_process.wait()
         if exit_val != 0:
             warning(_("Failed to start shell '%s'") % os.getenv('SHELL'))
+            # remove shell PID because GUI should not kill it
+            kv = read_gisrc(gisrc)
+            del kv['PID']
+            write_gisrc(kv, gisrc)
+            # if there is no shell but GUI is set, wait for that
+            if grass_gui != "text":
+                gui_process.wait()

         # close GUI if running
         close_gui()

However, with Ctrl+F2 I still get the same behavior. I don't see anything helpful in the sudo strace -p... -s9999 -e write output (using PID of grass and gis_set.py).

grass-svn2git commented 5 years ago

Comment by @neteler on 26 Jan 2018 11:40 UTC Ticket retargeted after milestone closed

grass-svn2git commented 5 years ago

Modified by @neteler on 12 Jun 2018 20:48 UTC

grass-svn2git commented 5 years ago

Modified by @wenzeslaus on 17 Sep 2018 03:34 UTC