hanging-threads


Namehanging-threads JSON
Version 2.0.7 PyPI version JSON
download
home_pagehttps://github.com/niccokunzmann/hanging_threads
SummaryDeadlocks? Detect where your threads hang in Python with one import.
upload_time2024-02-17 17:30:26
maintainer
docs_urlNone
authorNicco Kunzmann
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            hanging_threads
===============

Deadlocks? Detect where your threads hang in Python.

.. image:: https://travis-ci.org/niccokunzmann/hanging_threads.svg
   :target: https://travis-ci.org/niccokunzmann/hanging_threads
   :alt: Build Status

.. image:: https://badge.fury.io/py/hanging_threads.svg
   :target: https://pypi.python.org/pypi/hanging_threads
   :alt: Python Package Index

Installation
------------

Install the module with pip:

.. code:: bash

    pip install hanging_threads


If installing with **Windows**, open the command line program "cmd" and type

.. code:: bash

    py -m pip install hanging_threads


Usage
-----

Monitoring is as simple as calling the start_monitoring() function.

.. code:: python

    from hanging_threads import start_monitoring
    monitoring_thread = start_monitoring()

You may also pass additional parameters.

.. code:: python

    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.

.. code:: python

    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.

   .. code:: bash

       git add README.rst hanging_threads.py
       git commit -m"v2.0.7"
       git push

2. Create a tag for the version.

   .. code:: bash

       git tag v2.0.7
       git push origin v2.0.7

3. Notify solved issues about the release.


Further Reading
---------------

- `GIL-deadlocks are not covered by this <http://stackoverflow.com/questions/10014481/python-threads-hang#comment33263430_17744731>`__
- `Package requested, so this was created <http://stackoverflow.com/questions/3443607/how-can-i-tell-where-my-python-script-is-hanging/17744556#comment69129716_17744556>`__
- `faulthandler since Python 3.3 allows dumping stack traces <https://docs.python.org/3/library/faulthandler.html>`__
- `Discussion and the source GitHub Gist <https://gist.github.com/niccokunzmann/6038331>`__



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/niccokunzmann/hanging_threads",
    "name": "hanging-threads",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Nicco Kunzmann",
    "author_email": "niccokunzmann@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/92/82/06eb3c0b55e205f7739243fb9dec8814a098716ebb6dbec5c0f7c8694488/hanging_threads-2.0.7.tar.gz",
    "platform": "any",
    "description": "hanging_threads\n===============\n\nDeadlocks? Detect where your threads hang in Python.\n\n.. image:: https://travis-ci.org/niccokunzmann/hanging_threads.svg\n   :target: https://travis-ci.org/niccokunzmann/hanging_threads\n   :alt: Build Status\n\n.. image:: https://badge.fury.io/py/hanging_threads.svg\n   :target: https://pypi.python.org/pypi/hanging_threads\n   :alt: Python Package Index\n\nInstallation\n------------\n\nInstall the module with pip:\n\n.. code:: bash\n\n    pip install hanging_threads\n\n\nIf installing with **Windows**, open the command line program \"cmd\" and type\n\n.. code:: bash\n\n    py -m pip install hanging_threads\n\n\nUsage\n-----\n\nMonitoring is as simple as calling the start_monitoring() function.\n\n.. code:: python\n\n    from hanging_threads import start_monitoring\n    monitoring_thread = start_monitoring()\n\nYou may also pass additional parameters.\n\n.. code:: python\n\n    monitoring_thread = start_monitoring(seconds_frozen=10, test_interval=100)\n\nThe values in the example are defaults. This mean the check will happen 10\ntimes per second. If a thread is frozen for at least 10 seconds then the stack\nis dumped into standard error stream. This happens again every 10 seconds\nwhile there is no changes in the stack registered during checks. Checks are done in\nintervals of 100ms.\n\nNote that it makes sense to save the thread object into variable so that you or\nsomebody else can stop the annoying dumps if needed.\nFor example, you may want to do this in the Python shell.\n\n.. code:: python\n\n    monitoring_thread.stop()\n\nChangelog\n---------\n\n- v2.0.7: Start changelog, fix crash when line number is not known.\n\nNew Releases\n------------\n\nTo release a new version:\n\n1. Edit the ``README.md`` file in the Changelog Section and add the changes. Increase the ``hanging_threads.py`` version.\n\n   .. code:: bash\n\n       git add README.rst hanging_threads.py\n       git commit -m\"v2.0.7\"\n       git push\n\n2. Create a tag for the version.\n\n   .. code:: bash\n\n       git tag v2.0.7\n       git push origin v2.0.7\n\n3. Notify solved issues about the release.\n\n\nFurther Reading\n---------------\n\n- `GIL-deadlocks are not covered by this <http://stackoverflow.com/questions/10014481/python-threads-hang#comment33263430_17744731>`__\n- `Package requested, so this was created <http://stackoverflow.com/questions/3443607/how-can-i-tell-where-my-python-script-is-hanging/17744556#comment69129716_17744556>`__\n- `faulthandler since Python 3.3 allows dumping stack traces <https://docs.python.org/3/library/faulthandler.html>`__\n- `Discussion and the source GitHub Gist <https://gist.github.com/niccokunzmann/6038331>`__\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Deadlocks? Detect where your threads hang in Python with one import.",
    "version": "2.0.7",
    "project_urls": {
        "Homepage": "https://github.com/niccokunzmann/hanging_threads"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d6a2c0119bc9745bb5b3e7cb5cb962b84282d5d37fb8827c72d9ded7ce3a078",
                "md5": "04446527c4654f601ad88124509ee513",
                "sha256": "a6cbfd962dfa02731899081f12e7ac51279e0170dcb4b6421e7c5a320176b744"
            },
            "downloads": -1,
            "filename": "hanging_threads-2.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04446527c4654f601ad88124509ee513",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5480,
            "upload_time": "2024-02-17T17:30:24",
            "upload_time_iso_8601": "2024-02-17T17:30:24.610345Z",
            "url": "https://files.pythonhosted.org/packages/1d/6a/2c0119bc9745bb5b3e7cb5cb962b84282d5d37fb8827c72d9ded7ce3a078/hanging_threads-2.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "928206eb3c0b55e205f7739243fb9dec8814a098716ebb6dbec5c0f7c8694488",
                "md5": "ec700add08d2449a1c33337c21b7659e",
                "sha256": "5cfc1e34fcf9e6a0215cf8e0425532b77bd34ce0355a84e410fdc8e1ea15104a"
            },
            "downloads": -1,
            "filename": "hanging_threads-2.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "ec700add08d2449a1c33337c21b7659e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5206,
            "upload_time": "2024-02-17T17:30:26",
            "upload_time_iso_8601": "2024-02-17T17:30:26.821823Z",
            "url": "https://files.pythonhosted.org/packages/92/82/06eb3c0b55e205f7739243fb9dec8814a098716ebb6dbec5c0f7c8694488/hanging_threads-2.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-17 17:30:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "niccokunzmann",
    "github_project": "hanging_threads",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hanging-threads"
}
        
Elapsed time: 0.51626s