Deadlocks? Detect where your threads hang in Python with one import.
Project description
Deadlocks? Detect where your threads hang in Python.
Install
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
Usage
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, tests_per_second=10)
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.
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.
monitoring_thread.stop()
Useful Stackoverflow links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for hanging_threads-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79473c639369d2f2eb3e57f24488273708808e08bcded23b9456c8fe0fb9a230 |
|
MD5 | c998a0f4a597c428538803f558ec0dc6 |
|
BLAKE2b-256 | 5e03507e92c123e6d64c3860e630ad59f6bd5ab1237327ad2f204ddfcbf54dc1 |
Hashes for hanging_threads-2.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f01284bd2fd5617778699d4fa6bad931c0e09325b1e57a112cafa50a741488f5 |
|
MD5 | 987487217813de835b9bba547106d79d |
|
BLAKE2b-256 | 7fae4f472e25f05ac8b52a11716b958f19a149a3101292824dc9e166babadf43 |