Skip to content

Instantly share code, notes, and snippets.

@zgohr
Created April 12, 2018 02:00
Show Gist options
  • Save zgohr/748d161a747d9e061e3172fd10e64b40 to your computer and use it in GitHub Desktop.
Save zgohr/748d161a747d9e061e3172fd10e64b40 to your computer and use it in GitHub Desktop.
stack trace for all threads of a running python process
sudo apt-get install gdb
pip install pyrasite
pyrasite-shell {pid}
import sys, traceback
for tid, frame in sys._current_frames().items():
    print("Stack for thread {}".format(tid))
    traceback.print_stack(frame)
    print("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment