-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Bug report
See #130163 (comment) for reproducer.
Yeah, I think that's another bug with
_PyObject_ResurrectEnd
. In the resurrection case, the object may still be deallocated. In particular,_Py_brc_queue_object()
may immediately free the object or lead to it being freed by another thread. The calls below_PyObject_ResurrectEnd()
are not safe:Lines 594 to 604 in 655fc8a
if (!_PyObject_ResurrectEnd(self)) { return 0; /* this is the normal path out */ } /* tp_finalize resurrected it! Make it look like the original Py_DECREF * never happened. */ _Py_ResurrectReference(self); _PyObject_ASSERT(self, (!_PyType_IS_GC(Py_TYPE(self)) || _PyObject_GC_IS_TRACKED(self))); We either need to ensure that the object remains alive after
_PyObject_ResurrectEnd()
returns1
, or rearrange the resurrection code.
Originally posted by @colesbury in #130163
I am not yet sure how we want to fix this.
Linked PRs
Metadata
Metadata
Assignees
Labels
topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump