-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Failed assertion in Python/legacy_tracing.c:431
on a free-threading build
#127235
Comments
Does this occur without use of the private |
I'm pretty sure that this is not limited to free threading. It's not safe to access other The reproducers involving the GIL are slightly more complicated because Lines 2402 to 2421 in 3e7ce6e
I think we have various reports of the same underlying issue. This issue is a nice reproducer for free threading, though. For example: |
Ok, I've pondered this issue for a day or so and I think that the simplest solution for this specific case is to just wait for the per-interpreter thread state lock (GH-127115) to get merged. The much bigger issue at hand here is that Some other functions we need to worry about in terms of thread safety:
For the future, I think we should probably steer clear of any support for using a detached thread state. Perhaps we could invent some new API ( TL;DR we probably need to document and deprecate some non-thread-safe thread state APIs. |
Crash report
What happened?
It's possible to cause an abort on
!_PyMem_IsPtrFreed(tstate)
while running withPYTHON_GIL=0
by calling the following code:Abort message:
Not sure this isn't an expected failure mode.
Found using fusil by @vstinner.
CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0a2+ experimental free-threading build (heads/main-dirty:a13e94d84bf, Nov 23 2024, 07:16:19) [GCC 11.4.0]
The text was updated successfully, but these errors were encountered: