Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.13] gh-119525: Fix deadlock with _PyType_Lookup and the GIL (GH-119527) #119746

Merged
merged 1 commit into from
May 29, 2024

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 29, 2024

The deadlock only affected the free-threaded build and only occurred
when the GIL was enabled at runtime. The Py_DECREF(old_name) call
might temporarily release the GIL while holding the type seqlock.
Another thread may spin trying to acquire the seqlock while holding the
GIL.

The deadlock occurred roughly 1 in ~1,000 runs of pool_in_threads.py
from test_multiprocessing_pool_circular_import.
(cherry picked from commit c22323c)

Co-authored-by: Sam Gross colesbury@gmail.com

…onGH-119527)

The deadlock only affected the free-threaded build and only occurred
when the GIL was enabled at runtime. The `Py_DECREF(old_name)` call
might temporarily release the GIL while holding the type seqlock.
Another thread may spin trying to acquire the seqlock while holding the
GIL.

The deadlock occurred roughly 1 in ~1,000 runs of `pool_in_threads.py`
from `test_multiprocessing_pool_circular_import`.
(cherry picked from commit c22323c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@colesbury colesbury enabled auto-merge (squash) May 29, 2024 19:26
@colesbury colesbury merged commit dcfbd3b into python:3.13 May 29, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants