`_PyObject_ResurrectEnd` may deallocate object in the "resurrection" case · Issue #130202 · python/cpython · GitHub
Skip to content

_PyObject_ResurrectEnd may deallocate object in the "resurrection" case #130202

Description

@colesbury

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:

cpython/Objects/object.c

Lines 594 to 604 in 655fc8a

We either need to ensure that the object remains alive after _PyObject_ResurrectEnd() returns 1, or rearrange the resurrection code.

Originally posted by @colesbury in #130163

I am not yet sure how we want to fix this.

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

topic-free-threadingtype-bugAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions