[issue29640] _PyThreadState_Init and fork race leads to inconsistent key list

Petr Viktorin report at bugs.python.org
Wed Mar 1 06:14:07 EST 2017


Petr Viktorin added the comment:

Here is a proof of concept patch from Jaroslav Škarvada. It fixes the problem by holding the mutex used for PyThread_create_key while forking.

To make it more than PoC it needs adding _PyThread_AcquireKeyLock and _ReleaseKeyLock (similar to _PyImport_AcquireLock() etc.) and calling those.  Other than that, does this approach look reasonable?

----------
keywords: +patch
nosy: +encukou
Added file: http://bugs.python.org/file46682/fork_hold_keymutex.patch

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


More information about the Python-bugs-list mailing list