[Twisted-Python] Non-terminating Process using gtkreactor2

I have a GTK program using twisted 2.1.0 and python 2.4. On both Linux and Windows the program reliably fails to terminate after calling gtk.main_quit() and reactor.stop(). It just sits there. All the windows close, but the process remains running.
It will terminate happily if the program has merely been run, but if "things" have happened, the program refuses to die. I am guessing that this is because there are deferreds loitering around unfired, or some GTK resources remain that refuse to die.
To kill the process after this, it must be sent a KILL signal, TERM is not sufficient. On windows it can be killed in the Task Manager processes tab.
I admit I am at a loss as to how to debug this - can someone give me some pointers to diagnostics I can try to find out what the problem is?
Cheers,
Doug.

On Fri, 02 Dec 2005 10:07:17 +0000, Doug Winter doug@isotoma.com wrote:
I have a GTK program using twisted 2.1.0 and python 2.4. On both Linux and Windows the program reliably fails to terminate after calling gtk.main_quit() and reactor.stop(). It just sits there. All the windows close, but the process remains running.
AFAICT the twisted example pbgtk2.py seems to do the wrong thing here, and it too freezes up when the destroy handler of the login window is called. if you call reactor.stop(), rather than gtk.main_quit() (assuming the gtk2reactor is installed) then your program will terminate normally.

Moe Aboulkheir wrote:
On Fri, 02 Dec 2005 10:07:17 +0000, Doug Winter doug@isotoma.com wrote:
I have a GTK program using twisted 2.1.0 and python 2.4. On both Linux and Windows the program reliably fails to terminate after calling gtk.main_quit() and reactor.stop(). It just sits there. All the windows close, but the process remains running.
AFAICT the twisted example pbgtk2.py seems to do the wrong thing here, and it too freezes up when the destroy handler of the login window is called. if you call reactor.stop(), rather than gtk.main_quit() (assuming the gtk2reactor is installed) then your program will terminate normally.
Great, that's fixed it. Thanks!
doug.

I admit I am at a loss as to how to debug this - can someone give me some pointers to diagnostics I can try to find out what the problem is?
In general, when your program hangs and you don't know what it's waiting for, it can help to run it in a debugger like WinPDB, and break the program when it's stuck. Then you can see the stack trace for every thread, and it sometimes tells you a lot about what's keeping the program waiting.
participants (3)
-
Doug Winter
-
Micky Latowicki
-
Moe Aboulkheir