You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
test_socketserver.
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.
Activity
pitrou commentedon Oct 27, 2009
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
test_socketserver.
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.
pitrou commentedon Oct 27, 2009
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
before.
pitrou commentedon Oct 27, 2009
Forget the last message. While improving Thread.join() can be good, it
still doesn't guarantee that all references have been released.
pitrou commentedon Oct 27, 2009
Here's a new patch with tests.
pitrou commentedon Oct 30, 2009
Committed in r75958, r75959.