Skip to content

Instantly share code, notes, and snippets.

@mikahanninen
Created May 2, 2023 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikahanninen/8e3f42b909d6c1e19a83203ecb393fed to your computer and use it in GitHub Desktop.
Save mikahanninen/8e3f42b909d6c1e19a83203ecb393fed to your computer and use it in GitHub Desktop.
Getting thread dump when Python gets stuck
import threading
from _pydevd_bundle import pydevd_utils
import time
def dump_threads_after_timeout():
time.sleep(5)
pydevd_utils.dump_threads()
def this_is_going_to_stuck():
threading.Thread(target=dump_threads_after_timeout).start()
stuck()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment