-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
returning after forking a child thread doesn't call Py_Finalize #50891
Comments
I attached a test case to reproduce. Here is what it does:
What should happen is that the forked child process should terminate What happens is that because it was a child thread that forked, the C 24325 pts/3 Ss 0:01 bash Here's the stack traces from the parent process: The child process is defunct, but you can still trace the left over (gdb) bt You can see that it's stuck in the daemon's busy loop from the test case. So what's the right way to fix this? Should Py_Finalize be called for I'm willing to write the fix if we can agree on a solution. |
Here's a patch against 2.6 for one way to fix it. I imagine it has This patch builds on the patch for http://bugs.python.org/issue6643 |
Python 3.x is affected, too. |
Shouldn't the child process be terminating using os._exit()? |
I add the "Subinterpreters" component even if the issue is about the main interpreter, this kind of issue impacts subinterpreters. |
It os fundamentally not safe to fork() from a threaded process. This is a platform POSIX limitation, not Python. See also #100228 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: