[issue40092] Crash in _PyThreadState_DeleteExcept() at fork in the process child

Michael Felt report at bugs.python.org
Thu Apr 1 07:20:55 EDT 2021


Michael Felt <aixtools at felt.demon.nl> added the comment:

OK. Please explain. Looking at tstate assignment

In posixmodule.c:PyOSAfterFork_Child()
    PyStatus status;
    _PyRuntimeState *runtime = &_PyRuntime;

...
    PyThreadState *tstate = _PyThreadState_GET();

and later calls
    status = _PyRuntimeState_ReInitThreads(runtime);

Yet in Posix/ceval.c
PyStatus
_PyEval_ReInitThreads(PyThreadState *tstate)
{
    _PyRuntimeState *runtime = tstate->interp->runtime;

** this looks like runtime->interp->runtime

And then we get down to:
    /* Destroy all threads except the current one */
    _PyThreadState_DeleteExcept(runtime, tstate);

Is this correct - as it looks like:
_PyThreadState_DeleteExcept(runtime->interp->runtime, runtime) -- where runtime == &_PyRuntime;

----------

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


More information about the Python-bugs-list mailing list