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
socketserver.ForkingMixIn.server_close() leaks zombie processes #75334
Comments
It seems like test_socketserver leaks child processes on the "x86 Gentoo Refleaks 3.6" buildbot, but I'm unable to reproduce the bug. 0:48:11 load avg: 3.91 [154/405/2] test_socketserver failed -- running: test_decimal (630 sec) (...) test_ForkingUnixStreamServer (test.test_socketserver.SocketServerTest) ... creating server test_ForkingUnixDatagramServer (test.test_socketserver.SocketServerTest) ... creating server test_ForkingUDPServer (test.test_socketserver.SocketServerTest) ... creating server |
Ah, the master branch is also affected. Example: 1:35:05 load avg: 4.64 [212/406] test_socketserver passed -- running: test_subprocess (370 sec) |
The problem is that socketserver.ForkinMixin doesn't wait until all children completes. It's only calls os.waitpid() in non-blocking module (using os.WNOHANG) after each loop iteration. If a child process completes after the last call to ForkingMixIn.collect_children(), the server leaks zombie processes. The server must wait until all children completes. Attached PR implements that. The bug was be reproduced with the attached forkingmixin_sleep.patch. haypo@selma$ ./python -m test -v -u all test_socketserver --fail-env-changed -m '*Fork*' |
bpo-31010 has been marked as a duplicate of this issue. |
I created a thread on the python-dev mailing list to discuss this issue: |
I tag this issue as release blocker as a remainder that we have to agree how to handle threads/processes before Python 3.7 feature freeze. See also bpo-31233: socketserver.ThreadingMixIn leaks running threads after server_close(). |
I proposed the bpo-31593 to fix the issue differently in Python 3.6 (and maybe also Python 2.7). |
What's the status of this? Feature freeze is here! |
This issue is very to https://bugs.python.org/issue31233#msg311021 as it's status:
For beta1, IMHO it's ok to keep the current status. But I would like to see this issue fixed before 3.7 final. Either revert my change, or do something else. |
I created bpo-33540: "socketserver: Add an opt-in option to get Python 3.6 behaviour on server_close()". I set the release blocker priority on this new issue. |
The bug has been fixed in Python 3.7. |
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: