Message152445
| Author |
neologix |
| Recipients |
Martijn.van.Oosterhout, glaubich, neologix, pitrou, rosslagerwall |
| Date |
2012年02月01日.22:12:07 |
| SpamBayes Score |
2.7653482e-07 |
| Marked as misclassified |
No |
| Message-id |
<1328134328.54.0.84386058306.issue13817@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I thought about this a bit more, and I realized that a slight variation
of this bug also affects 2.7, and also older versions (i.e. before
_PyGILState_Reinit() was introduced), because any code that gets called
from PyOS_AfterFork() and uses the TLS API suffers from the same
problem.
I had the new test deadlock once, in theading._after_fork(): when trying
to acquire an (unlocked) lock, it got stuck in Py_END_ALLOW_THREADS,
which calls indirectly PyGILState_GetThisThreadState(), which calls
find_key().
Although less likely, this bug has been present for a *long* time, it's
surprising it had never been noticed before.
So the fix - calling PyThread_ReInitTLS() right at the beginning of PyOS_AfterFork() - should also be applied to 2.7.
I'll commit it tomorrow. |
|