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: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...) #85905
Comments
s390x RHEL8 LTO + PGO 3.x: 0:01:43 load avg: 4.23 [229/423/1] test_logging failed (env changed) -- running: test_concurrent_futures (48.1 sec) |
Same isuse on s390x RHEL7 LTO + PGO 3.x: Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2) |
s390x Debian 3.x: Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2) |
I created bpo-41833 "threading.Thread: use target name if the name parameter is omitted" to help me to debug this issue. |
Cool, my threading change works as expected! The name of the target function was logged. https://buildbot.python.org/all/#/builders/509/builds/172 0:00:28 load avg: 3.58 [ 36/424/1] test_logging failed (env changed) So leaked threads are running removeTarget() which come from MemoryHandlerTest.test_race_between_set_target_and_flush(). |
I'm able to reproduce the issue if I reduce the sleep: diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 4cd8c7e25d..fc395dc473 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1177,7 +1177,7 @@ class MemoryHandlerTest(BaseTest):
self.mem_hdlr.setTarget(target)
for _ in range(10):
- time.sleep(0.005)
+ time.sleep(1e-9)
self.mem_logger.info("not flushed")
self.mem_logger.warning("flushed")
With the command: $ ./python -m test test_logging -m test_race_between_set_target_and_flush -F -j10 --fail-env-changed
(...)
0:00:03 load avg: 3.74 [ 18/1] test_logging failed (env changed)
Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2)
Warning -- Dangling thread: <Thread(Thread-1 (removeTarget), started daemon 139860955428608)>
Warning -- Dangling thread: <_MainThread(MainThread, started 139861194377024)> |
Ok, test_race_between_set_target_and_flush() should no longer leak dangling threads. I close the issue. |
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: