[issue39958] Deadlock in _PyInterpreterState_DeleteExceptMain with HEAD_LOCK(runtime)

2020-03-13 Thread Atle Solbakken
Atle Solbakken added the comment: By "manually" clearing/deleting any interpreter states from non-main thread states prior to running (PyOS_AfterForkChild()), the deadlock does not occur. // With tstate_orig being a PyThreadState which is not main: PyInterpreterState *istate = t

[issue39958] Deadlock in _PyInterpreterState_DeleteExceptMain with HEAD_LOCK(runtime)

2020-03-13 Thread Atle Solbakken
New submission from Atle Solbakken : In _PyInterpreterState_DeleteExceptMain() aqcuires lock with HEAD_LOCK(runtime). With the lock still held and if a interpreter state is to be cleared, _PyInterpreterState_Clear() is called. HEAD_LOCK(runtime) is then called again (from within Clear