This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author anselm.kruis
Recipients anselm.kruis
Date 2019-08-08.08:47:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565254036.46.0.124559684376.issue37788@roundup.psfhosted.org>
In-reply-to
Content
The root cause for the reference leak is the global set threading._shutdown_locks. It contains Thread._tstate_lock locks of non-daemon threads. If a non-daemon thread terminates and no other thread joins the terminated thread, the _tstate_lock remains in threading._shutdown_locks forever.

I could imagine that a long running server could accumulate many locks in threading._shutdown_locks over time. Therefore the leak should be fixed.

There are probably several ways to deal with this issue. A straight forward approach is to discard the lock from within `tstate->on_delete` hook, that is function "void release_sentinel(void *)" in _threadmodule.c. Pull request (GH-15175) implements this idea. Eventually I should add another C-Python specific test-case to the PR.
History
Date User Action Args
2019-08-08 08:47:16anselm.kruissetrecipients: + anselm.kruis
2019-08-08 08:47:16anselm.kruissetmessageid: <1565254036.46.0.124559684376.issue37788@roundup.psfhosted.org>
2019-08-08 08:47:16anselm.kruislinkissue37788 messages
2019-08-08 08:47:16anselm.kruiscreate