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
test_logging leaks dangling threads on FreeBSD #75013
Comments
test_output (test.test_logging.HTTPHandlerTest) ... ok See also the previous test_logging threads issue, bpo-30131. |
I failed to reproduce the issue by running test_logging in a loop on Koobs's FreeBSD CURRENT. |
test_listen_config_10_ok (test.test_logging.ConfigDictTest) ... Warning -- threading_cleanup() failed to cleanup -1 threads after 3 sec (count: 0, dangling: 1) 1 test altered the execution environment: Tests result: ENV CHANGED |
Another test_listen_config_10_ok() example: test_config_8a_ok (test.test_logging.ConfigDictTest) ... ok |
bpo-31041 has been marked as a duplicate of this issue. Extracts: test_handle_called_with_mp_queue (test.test_logging.QueueListenerTest) ... and test_handle_called_with_mp_queue (test.test_logging.QueueListenerTest) ... -- "Maybe threading_cleanup() should call support.gc_collect()." |
test_output (test.test_logging.UnixDatagramHandlerTest) ... ok |
The problem is that socketserver.ThreadingMixIn spawns threads without waiting for their completion in server_close(). For example, the following two tests use socketserver.ThreadingMixIn and so can leak a running thread:
Example: 10-STABLE-amd64% ./python -m test -v test_logging --fail-env-changed -F -m test.test_logging.DatagramHandlerTest.test_output -m test.test_logging.ConfigDictTest.test_listen_config_10_ok --match=test.test_logging.SocketHandlerTest.test_output (...) 0:00:09 load avg: 2.54 [ 7] test_logging |
Oh, I forgot to mention that I also run "./python -m test -j4" in a different terminal in parallel to make the bug more likely. |
I opened bpo-31233: socketserver.ThreadingMixIn leaks running threads after server_close(). |
With this commit, test_logging should detect better bugs in the code. The commit also skips all tests using socketserver, until bpo-31233 is fixed, just to reduce the failure rate on the FreeBSD buildbots. This issue (bpo-30830) made FreeBSD 10 buildbot very unstable. |
While testing PR 3138 (stricter threading_cleanup) with PR 3523 (socketserver joins threads), I got the following warning: test_listen_config_1_ok (test.test_logging.ConfigDictTest) ... Warning -- threading_cleanup() detected 1 leaked threads (count: 1, dangling: 2) Attached PR 3524 should fix this warning, once combined with PR 3523. |
Ok, the main bugs have been fixed by the following socketserver fix. commit b8f4163
I'm not sure that it's possible to fix the bug in Python 3.6 without breaking the backward compatibility. test_logging shouldn't fail with the threading_cleanup() warning anymore. |
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: