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.

Title: thread reaping is imperfect
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: nnorwitz, pitrou, r.david.murray
Priority: normal Keywords: patch

Created on 2009-10-27 21:24 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
threading_setup.patch pitrou, 2009-10-27 21:24
threading_setup2.patch pitrou, 2009-10-27 23:41
Messages (5)
msg94582 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-27 21:24
Thread reaping in test_support is imperfect because, even when a thread
has a disappeared from _active and _limbo, the Thread object might still
be hanging somewhere in memory (leaving its last instants). This problem
manifests itself when trying to fix the transient refleaks in

One solution I've found is to add a _count() method to the thread
module, which returns the number of running threads from the point of
view of the C extension. When _count() is decremented, we can be sure
the Python method has finished running and the Thread object is not
hanging around.
msg94584 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-27 22:14
Thinking about it, another possibility is to strengthen Thread.join(),
so that it waits for the actual end of the thread, not a small instant
msg94586 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-27 23:25
Forget the last message. While improving Thread.join() can be good, it
still doesn't guarantee that all references have been released.
msg94592 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-27 23:41
Here's a new patch with tests.
msg94716 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-30 17:25
Committed in r75958, r75959.
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51471
2009-10-30 17:25:52pitrousetstatus: open -> closed
resolution: fixed
messages: + msg94716

stage: patch review -> resolved
2009-10-27 23:41:21pitrousetfiles: + threading_setup2.patch

messages: + msg94592
2009-10-27 23:25:07pitrousetmessages: + msg94586
2009-10-27 22:14:14pitrousetmessages: + msg94584
2009-10-27 21:24:22pitroucreate