-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Race between grow_thread_array and _Py_qsbr_reserve under free threading #129732
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
Labels
Comments
hawkinsp
added a commit
to hawkinsp/cpython
that referenced
this issue
Feb 6, 2025
The read of shared->array should happen under the lock. Fixes python#129732
hawkinsp
added a commit
to hawkinsp/cpython
that referenced
this issue
Feb 6, 2025
…-threading. The read of shared->array should happen under the lock to avoid a race. Fixes python#129732
hawkinsp
added a commit
to hawkinsp/cpython
that referenced
this issue
Feb 6, 2025
…-threading. The read of shared->array should happen under the lock to avoid a race. Fixes python#129732
hawkinsp
added a commit
to hawkinsp/cpython
that referenced
this issue
Feb 6, 2025
…-threading. The read of shared->array should happen under the lock to avoid a race. Fixes python#129732
colesbury
pushed a commit
that referenced
this issue
Feb 6, 2025
…ing (gh-129738) The read of `shared->array` should happen under the lock to avoid a race.
colesbury
pushed a commit
to colesbury/cpython
that referenced
this issue
Feb 6, 2025
…r free-threading (pythongh-129738) The read of `shared->array` should happen under the lock to avoid a race. (cherry picked from commit b4ff8b2) Co-authored-by: Peter Hawkins <[email protected]>
colesbury
added a commit
that referenced
this issue
Feb 6, 2025
…-threading (gh-129738) (gh-129747) The read of `shared->array` should happen under the lock to avoid a race. (cherry picked from commit b4ff8b2) Co-authored-by: Peter Hawkins <[email protected]>
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Feb 7, 2025
…threading (pythongh-129738) The read of `shared->array` should happen under the lock to avoid a race.
cmaloney
pushed a commit
to cmaloney/cpython
that referenced
this issue
Feb 8, 2025
…threading (pythongh-129738) The read of `shared->array` should happen under the lock to avoid a race.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Bug description:
I don't have a succinct reproducer for this bug yet, but I saw the following race in JAX CI:
jax-ml/jax#26359
I think what's happening here is that two threads that were not created by Python are calling
PyGILState_Ensure
concurrently, so they can call into CPython APIs.This appears to be an unlocked access on
shared->array
and it would probably be sufficient to move that read under the mutex in_Py_qsbr_reserve
.CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
shared->array
in qsbr code under free-threading (gh-129738) #129747The text was updated successfully, but these errors were encountered: