On Tue, 16 Jan 2007 09:11:38 -0500, Jean-Paul Calderone wrote: > On Tue, 16 Jan 2007 00:23:35 -0500, "Stuart D. Gathman" > <[EMAIL PROTECTED]> wrote: >>I have a ThreadingTCPServer application (pygossip, part of >>http://sourceforge.net/projects/pymilter). It mostly runs well, but >>occasionally goes into a loop. How can I get a stack trace of running >>threads to figure out where the loop is? Is there some equivalent of >>sending SIGQUIT to Java to get a thread dump? If needed, I can import >>pdb and set options at startup, but there needs to be some external way >>of triggering the dump since I can't reproduce it at will. > > Grab the gdbinit out of Python SVN Misc/ directory. Apply this patch: > > http://jcalderone.livejournal.com/28224.html > > Attach to the process using gdb. Make sure you have debugging symbols > in your build of Python. Run 'thread apply all pystack'.
Did this. gdb displays main thread fine (waiting on accept(), duh). But gdb goes into a loop displaying the first worker thread. There are no extension modules other than the batteries included ones. In this application, I believe, only _socket. (I.e. a pure python server.) I will try for a C stack trace next time it loops. Also, the looping server needs kill -9. SIGTERM and SIGINT won't stop it. And after it dies with SIGKILL, the port is still in use for 5 minutes or so (and the server cannot be restarted). This is really making me appreciate Java. -- Stuart D. Gathman <[EMAIL PROTECTED]> Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flamis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. -- http://mail.python.org/mailman/listinfo/python-list