Skip to main content

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

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:

  1. 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 push
  2. Create a tag for the version.

    git tag v2.0.7
    git push origin v2.0.7
  3. Notify solved issues about the release.

Further Reading

Project details


Download files

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

Source Distribution

hanging_threads-2.0.7.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

hanging_threads-2.0.7-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page