[issue18418] Thread.isAlive() sometimes True after fork

Gregory P. Smith report at bugs.python.org
Mon Jul 15 21:15:57 CEST 2013


Gregory P. Smith added the comment:

This patch makes sense to me.  I've gone over the code and I cannot spot any adverse effects.  I was wondering in particular if anything would be surprised to find a non-started thread in _active within the short window where that will be true but nothing appears to care about that.

You should add a comment to the code mentioning this issue and why the .set() is done after the _active insertion.  After that, I'd say commit it.

If you want a consistent reproducible test case for this I believe you will need to replace the Thread object's __started with a test wrapper who's set() method blocks waiting for for the fork to have happened before doing the actual set().  That is a bit tricky and may not be worth it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18418>
_______________________________________


More information about the Python-bugs-list mailing list