-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Multithreaded subinterpreters can be running during finalization #126016
Comments
Using .join() will not trigger an assertion error. For the reason, please see the PR submitted by Eric and me.
|
Yes, I know. The issue is that CTRL+C'ing causes the thread to not finish joining, meaning that the thread state is still marked as running. I'm working on a fix to properly clean up thread states before the interpreter shuts down using pending calls, but daemon threads will probably have to get addressed elsewhere (there's a data race, I think). |
If you want, you can insert a signal catcher to catch |
That would result in a thread safety nightmare if the thread was still running :) |
#126026 addresses non-daemon threads. It's a bit hacky, though, because I have to manually mess with the status of the thread state. |
Crash report
What happened?
(Found while investigating a fix for #125920.)
Subinterpreters that are running in a different thread can still be running upon the finalization of the main interpreter, depending on what the thread was doing. Take the following script:
On 3.13 and 3.14, killing the process with CTRL+C results in an assertion failure:
However, if the thread is daemon, then the interpreter fully segfaults:
I'm going to investigate possible fixes.
cc @ericsnowcurrently
CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: