[issue33612] Assertion failure in PyThreadState_Clear

STINNER Victor report at bugs.python.org
Wed May 23 05:44:59 EDT 2018


STINNER Victor <vstinner at redhat.com> added the comment:

Failing assertion:

    /* The stack of exception states should contain just this thread. */
    assert(tstate->exc_info->previous_item == NULL);

"test_multiprocessing_fork passed in 9 min 13 sec"

Oh. A child process crashed on "self.pid = os.fork()" in "/Lib/multiprocessing/popen_fork.py", line 70 in _launch", but the test still pass.

os.fork() calls PyOS_AfterFork_Child() which starts by calling _PyGILState_Reinit() which ends with "_PyThreadState_DeleteExcept(current_tstate);".

_PyThreadState_DeleteExcept() creates a "garbage" list of thread states, and then call PyThreadState_Clear() on each thread. Finally, one call to PyThreadState_Clear() fails on the assertion.

I'm not sure that the assertion takes in account the case of specific case of fork().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33612>
_______________________________________


More information about the Python-bugs-list mailing list