New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

Dangling threads are reported when run test_socket tests which raise SkipTest 
in setUp() in refleak mode.

$ ./python -m test -R 3:3 test_socket -m testBCM
0:00:00 load avg: 2.53 Run tests sequentially
0:00:00 load avg: 2.53 [1/1] test_socket
beginning 6 repetitions
123456
.Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, 
dangling: 1)
Warning -- Dangling thread: <_MainThread(MainThread, started 139675429708416)>
.Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, 
dangling: 1)
Warning -- Dangling thread: <_MainThread(MainThread, started 139675429708416)>
.Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, 
dangling: 1)
Warning -- Dangling thread: <_MainThread(MainThread, started 139675429708416)>
...
test_socket failed (env changed)

== Tests result: SUCCESS ==

1 test altered the execution environment:
    test_socket

Total duration: 655 ms
Tests result: SUCCESS


It happens because tearDown() is not called if setUp() raises any exception 
(including SkipTest). If we want to execute some cleanup code it should be 
registered with addCleanup().

----------
components: Tests
messages: 401862
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Dangling threads in skipped tests in test_socket
type: resource usage
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45212>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to