Message394266
It seems that PyOS_AfterFork_Child() needs to do something like
PyThreadState *tstate = PyThreadState_Get();
PyObject *wr = _PyObject_CAST(tstate->on_delete_data);
PyObject *obj = PyWeakref_GET_OBJECT(wr);
lockobject *lock;
if (obj != Py_None) {
lock = (lockobject *) obj;
if (lock->locked) {
/* Leak memory on purpose. */
lock->locked = 0;
}
}
before the call to _PyEval_ReInitThreads.
Maybe encapsulate that as PyThread_ReInitThreads().
The locks in the threads in the child need to be cleared before _PyThreadState_DeleteExcept() so that Python does not try to release the locks in the child. |
|
Date |
User |
Action |
Args |
2021-05-24 20:16:41 | David.Edelsohn | set | recipients:
+ David.Edelsohn, vstinner, Michael.Felt, shihai1991 |
2021-05-24 20:16:41 | David.Edelsohn | set | messageid: <1621887401.22.0.0380670631889.issue40092@roundup.psfhosted.org> |
2021-05-24 20:16:41 | David.Edelsohn | link | issue40092 messages |
2021-05-24 20:16:41 | David.Edelsohn | create | |
|