Skip to content

Commit d29fecc

Browse files
authored
[3.6] bpo-30395 _PyGILState_Reinit deadlock fix (GH-1734) (#1740)
head_lock could be held by another thread when fork happened. We should reset it to avoid deadlock. (cherry picked from commit f82c951)
1 parent 1398b1b commit d29fecc

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ Eric Groo
552552
Daniel Andrade Groppe
553553
Dag Gruneau
554554
Filip Gruszczyński
555+
Andrii Grynenko
555556
Grzegorz Grzywacz
556557
Thomas Guettler
557558
Yuyang Guo

Python/pystate.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,10 @@ _PyGILState_Fini(void)
743743
void
744744
_PyGILState_Reinit(void)
745745
{
746+
#ifdef WITH_THREAD
747+
head_mutex = NULL;
748+
HEAD_INIT();
749+
#endif
746750
PyThreadState *tstate = PyGILState_GetThisThreadState();
747751
PyThread_delete_key(autoTLSkey);
748752
if ((autoTLSkey = PyThread_create_key()) == -1)

0 commit comments

Comments
 (0)