Repository navigation
test_asyncio.test_events failed with "env changed" on AMD64 FreeBSD14 3.14: Warning -- Unraisable exception (...) ResourceWarning: unclosed <socket...> #159123
Copy link
Copy link
Closed
Labels
OS-freebsdtestsTests in the Lib/test dirTests in the Lib/test dirtopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
AMD64 FreeBSD14 3.14: https://buildbot.python.org/#/builders/1740/builds/1746
test_create_server_reuse_port (test.test_asyncio.test_events.PollEventLoopTests.test_create_server_reuse_port) ... ok
test_create_server_sock (test.test_asyncio.test_events.PollEventLoopTests.test_create_server_sock) ... ok
test_create_server_ssl (test.test_asyncio.test_events.PollEventLoopTests.test_create_server_ssl) ... ok
test_create_server_ssl_match_failed (test.test_asyncio.test_events.PollEventLoopTests.test_create_server_ssl_match_failed) ... Warning -- Unraisable exception
Exception ignored while finalizing socket <socket.socket fd=7, family=2, type=1, proto=6, laddr=('127.0.0.1', 18337), raddr=('127.0.0.1', 39292)>:
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.14.opsec-fbsd14/build/Lib/test/support/__init__.py", line 861, in gc_collect
gc.collect()
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('127.0.0.1', 18337), raddr=('127.0.0.1', 39292)>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _SelectorTransport.__del__ at 0xafcf2b8bdd0>:
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.14.opsec-fbsd14/build/Lib/asyncio/selector_events.py", line 875, in __del__
_warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: unclosed transport <_SelectorSocketTransport closing fd=7>
ok
test_create_server_ssl_verified (test.test_asyncio.test_events.PollEventLoopTests.test_create_server_ssl_verified) ... ok
test_create_server_ssl_verify_failed (test.test_asyncio.test_events.PollEventLoopTests.test_create_server_ssl_verify_failed) ... Warning -- Unraisable exception
Exception ignored while finalizing socket <socket.socket fd=7, family=2, type=1, proto=6, laddr=('127.0.0.1', 54585), raddr=('127.0.0.1', 54281)>:
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.14.opsec-fbsd14/build/Lib/test/support/__init__.py", line 861, in gc_collect
gc.collect()
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('127.0.0.1', 54585), raddr=('127.0.0.1', 54281)>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _SelectorTransport.__del__ at 0xafcf2b8bdd0>:
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.14.opsec-fbsd14/build/Lib/asyncio/selector_events.py", line 875, in __del__
_warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: unclosed transport <_SelectorSocketTransport closing fd=7>
ok
test_create_server_trsock (test.test_asyncio.test_events.PollEventLoopTests.test_create_server_trsock) ... ok
test_create_ssl_connection (test.test_asyncio.test_events.PollEventLoopTests.test_create_ssl_connection) ... ok
test_create_ssl_unix_connection (test.test_asyncio.test_events.PollEventLoopTests.test_create_ssl_unix_connection) ... ok
test_create_unix_connection (test.test_asyncio.test_events.PollEventLoopTests.test_create_unix_connection) ... ok
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OS-freebsdtestsTests in the Lib/test dirTests in the Lib/test dirtopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
vstinner commentedon Oct 21, 2026
At least two
test_asyncio.test_eventstests are logging theunclosed <socket.socket ...>warning:vstinner commentedon Oct 21, 2026
I tried but failed so far to reproduce the issue on my FreeBSD 14 VM. I ran two commands in parallel (in tmux):
./python -u -X tracemalloc=10 -m test --fail-env-changed test_asyncio.test_events -v -F 2>&1|tee log./python -m test --fail-env-changed test_asyncio.test_events -W -j6 -FI ran these commands for 10 minutes.
vstinner commentedon Oct 21, 2026
Aha, the issue was also seen on AMD64 FreeBSD15 3.14: https://buildbot.python.org/#/builders/1749/builds/1904
and
vstinner commentedon Oct 21, 2026
@kumaraditya303: Would you mind to have a look at these 2 failing asyncio tests?
How can I reproduce these failures? Any idea on how to fix tests?
test_create_server_ssl_verify_failed() code is suspicious: it overrides call_exception_handler() and makes the logger quit. Why is it needed?
vstinner commentedon Oct 22, 2026
See also #160206 (test_ssl).
kumaraditya303 commentedon Oct 22, 2026
There is a race in test which is causing this, I created #160209 to fix this.
gh-159123: fix ResourceWarning flake in asyncio SSL handshake failure…