Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Deadlocks? Detect where your threads hang in Python with one import.

Project description

Deadlocks? Detect where your threads hang in Python.

Build Status Python Package Index


You can install the module with pip:

pip install hanging_threads

If you are under Windows, you can open the command line program “cmd” and type

py -m pip install hanging_threads


Starting monitoring as simple as calling the start_monitoring() function.

from hanging_threads import start_monitoring
monitoring_thread = start_monitoring()

You may also pass additional parameters.

monitoring_thread = start_monitoring(seconds_frozen=10, test_interval=100)

The values in the example are defaults. This mean the check will happen 10 times per second. If a thread is frozen for at least 10 seconds then the stack is dumped into standard error stream. This happens again every 10 seconds while there is no changes in the stack registered during checks. Checks are done in intervals of 100ms.

Note that it makes sense to save the thread object into variable so that you or somebody else can stop this annoying dumps if needed. For example, you may want to do this in Python shell.


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
hanging_threads-2.0.3-py2-none-any.whl (5.9 kB) Copy SHA256 hash SHA256 Wheel py2
hanging_threads-2.0.3-py3-none-any.whl (5.9 kB) Copy SHA256 hash SHA256 Wheel py3
hanging_threads-2.0.3.tar.gz (4.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page