I have to run a legacy Zope2 website and have some grievance with it. The biggest issue is that, occasionally, it just locks up, running at 100% CPU load and not answering t
You can print out a nice stack trace using pyrasite.
First, you'll need to have gdb installed.
# Redhat, CentOS, etc
$ yum install gdb
# Ubuntu, Debian, etc
$ apt-get update && apt-get install gdb
Then, install pyrasite.
$ pip install pyrasite
Use ps
or some other method to find the process ID for the stuck python process and run pyrasite-shell
with it.
# Assuming process ID is 12345
$ pyrasite-shell 12345
You should now see a python REPL. Run the following in the REPL to see stack traces for all threads.
import sys, traceback
for thread_id, frame in sys._current_frames().items():
print 'Stack for thread {}'.format(thread_id)
traceback.print_stack(frame)
print ''