-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
PyOS_Readline
crashes in a multi-threaded race
#123321
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
Comments
Do you actually need |
@gaogaotiantian I completely agree with your insight. The problem is that I've attempted achieving it with only threading and pdb, and for some reason it doesn't reproduce. Theoretically according to the faulting code it should (and should happen much more often). I'll give it another go. Haven't thought of testing purely with readline. Didn't notice the separate tests. |
By the way, out of interest, do you know why the free threading build fails on altering the execution environment? What does it mean? |
I'm assuming that this also occurs with |
Yeah, I managed to reproduce using |
That's great. I think you can update the test case and put in the file together with other |
For reference, here's the simplest piece of code that triggers the issue:
|
PyOS_Readline
crashes in a multi-threaded race
@gaogaotiantian @ZeroIntensity fix is ready. I appreciate your comments :-) |
… a multi-threaded race (pythonGH-123323) (cherry picked from commit a4562fe) Co-authored-by: Bar Harel <bharel@barharel.com>
… a multi-threaded race (pythonGH-123323) (cherry picked from commit a4562fe) Co-authored-by: Bar Harel <bharel@barharel.com>
…ed build Use a `PyMutex` to avoid the race in mutex initialization. Use relaxed atomics to avoid the data race on reading _PyOS_ReadlineTState when checking for re-entrant calls.
…g a multi-threaded race (GH-123323) (#123677) * gh-123321: Fix Parser/myreadline.c to prevent a segfault during a multi-threaded race (GH-123323) (cherry picked from commit a4562fe) Co-authored-by: Bar Harel <bharel@barharel.com> * Remove @requires_gil_enabled for 3.12 --------- Co-authored-by: Bar Harel <bharel@barharel.com> Co-authored-by: Sam Gross <colesbury@gmail.com>
…ld (#123690) Use a `PyMutex` to avoid the race in mutex initialization. Use relaxed atomics to avoid the data race on reading `_PyOS_ReadlineTState` when checking for re-entrant calls.
…ed build (pythonGH-123690) Use a `PyMutex` to avoid the race in mutex initialization. Use relaxed atomics to avoid the data race on reading `_PyOS_ReadlineTState` when checking for re-entrant calls. (cherry picked from commit 0c080d7) Co-authored-by: Sam Gross <colesbury@gmail.com>
…ded build (GH-123690) (#123798) gh-123321: Make Parser/myreadline.c locking safe in free-threaded build (GH-123690) Use a `PyMutex` to avoid the race in mutex initialization. Use relaxed atomics to avoid the data race on reading `_PyOS_ReadlineTState` when checking for re-entrant calls. (cherry picked from commit 0c080d7) Co-authored-by: Sam Gross <colesbury@gmail.com>
Crash report
What happened?
The second breakpoint segfaults on Windows (==access violation).
Core of the problem is in the myreadline.c module.
Implementing a fix...
CPython versions tested on:
3.12, CPython main branch
Operating systems tested on:
Windows
Output from running 'python -VV' on the command line:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: