Opened 11 years ago

Closed 11 years ago

#2253 closed defect (fixed)

WinGRASS doesn't allow to close console window

Reported by: martinl Owned by: grass-dev@…
Priority: blocker Milestone: 7.0.0
Component: wxGUI Version: svn-trunk
Keywords: wingrass, terminal window Cc:
CPU: Unspecified Platform: All

Description (last modified by martinl)

Steps to reproduce:

  1. Open GRASS with wxGUI
  2. Close wxGUI
  3. Enter exit

The terminal window hangs due to unfinished Python wxGUI-related process. So it's seems to be wxGUI bug...

Change History (9)

in reply to:  description comment:1 by martinl, 11 years ago

Description: modified (diff)

Replying to martinl:

Steps to reproduce:

# Open GRASS with wxGUI # Close wxGUI # Enter exit

The terminal window hangs due to unfinished Python wxGUI-related process. So it's seems to be wxGUI bug...

comment:2 by martinl, 11 years ago

See also #2291

comment:3 by annakrat, 11 years ago

Platform: MSWindows 2KAll

So, I found the revision since when the problem starts, it's r59204, there is something related to threading but I don't really know what's going on there.

It applies to Linux, too. wxGUI leaves a Python process behind.

in reply to:  3 comment:4 by annakrat, 11 years ago

Replying to annakrat:

So, I found the revision since when the problem starts, it's r59204, there is something related to threading but I don't really know what's going on there.

It applies to Linux, too. wxGUI leaves a Python process behind.

The problem was actually there even before but it appeared only when g.gui.iclass was running because the threading class gThread was used only there.

comment:5 by annakrat, 11 years ago

So it seems that r60429 solves the problem, it makes the thread a daemon thread. I am not sure if there can be any negative consequences of it.

in reply to:  5 comment:6 by glynn, 11 years ago

Replying to annakrat:

So it seems that r60429 solves the problem, it makes the thread a daemon thread. I am not sure if there can be any negative consequences of it.

The Python interpreter terminates when there are no non-daemon threads alive. Any remaining daemon threads will be killed at that point. Note that sys.exit() simply raises a SystemExit exception; if not caught, the calling thread (and only the calling thread) will be terminated.

Whether there are negative consequences to making other threads daemon threads would depend upon what those threads were doing at the time. If they need to complete a pending operation or perform clean-up, they won't get the opportunity.

Threads which can't safely be killed at any time shouldn't be daemon threads. They should have some mechanism by which they can be instructed to terminate in an orderly manner. One option is to have the main thread instruct such threads to terminate when it is about to terminate (whether normally or upon an exception, including SystemExit). Another option is to have the additional threads periodically check whether the main thread is alive, and terminate if it isn't.

comment:7 by annakrat, 11 years ago

Backported in r60489.

in reply to:  5 comment:8 by hellik, 11 years ago

Replying to annakrat:

So it seems that r60429 solves the problem, it makes the thread a daemon thread. I am not sure if there can be any negative consequences of it.

tested here with

System Info                                                                     
GRASS Version: 7.1.svn                                                          
GRASS SVN Revision: 60466                                                       
Erstellungsdatum: 2014-05-25                                                    
Build Platform: i686-pc-mingw32                                                 
GDAL/OGR: 1.11.0                                                                
PROJ.4: 4.8.0                                                                   
GEOS: 3.4.2                                                                     
SQLite: 3.7.17                                                                  
Python: 2.7.4                                                                   
wxPython: 2.8.12.1                                                              
Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)

confirmed. console windows closes now.

thanks.

in reply to:  7 comment:9 by martinl, 11 years ago

Resolution: fixed
Status: newclosed

Replying to annakrat:

Backported in r60489.

Confirmed, closing the ticket. Thanks.

Note: See TracTickets for help on using tickets.