Deadlocks? Detect where your threads hang in Python.
Installation
Install the module with pip:
pip install hanging_threads
If installing with Windows, open the command line program “cmd” and type
py -m pip install hanging_threads
Usage
Monitoring is 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 the annoying dumps if needed. For example, you may want to do this in the Python shell.
monitoring_thread.stop()
Changelog
v2.0.7: Start changelog, fix crash when line number is not known.
New Releases
To release a new version:
Edit the README.md file in the Changelog Section and add the changes. Increase the hanging_threads.py version.
git add README.rst hanging_threads.py git commit -m"v2.0.7" git pushCreate a tag for the version.
git tag v2.0.7 git push origin v2.0.7Notify solved issues about the release.
Further Reading
Metadata
Release files for hanging-threads 2.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hanging_threads-2.0.7.tar.gz | 5.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hanging_threads-2.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / hanging_threads-2.0.7.tar.gz
| Download URL | hanging_threads-2.0.7.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cfc1e34fcf9e6a0215cf8e0425532b77bd34ce0355a84e410fdc8e1ea15104a
|
|
BLAKE2b-256 checksum How to use checksums |
928206eb3c0b55e205f7739243fb9dec8814a098716ebb6dbec5c0f7c8694488
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|
Release files / hanging_threads-2.0.7-py3-none-any.whl
| Download URL | hanging_threads-2.0.7-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6cbfd962dfa02731899081f12e7ac51279e0170dcb4b6421e7c5a320176b744
|
|
BLAKE2b-256 checksum How to use checksums |
1d6a2c0119bc9745bb5b3e7cb5cb962b84282d5d37fb8827c72d9ded7ce3a078
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|
Security for hanging-threads 2.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.