Created
May 2, 2023 14:04
-
-
Save mikahanninen/8e3f42b909d6c1e19a83203ecb393fed to your computer and use it in GitHub Desktop.
Getting thread dump when Python gets stuck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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