Skip to content

gh-155941: Close the transport when a plain client_connected_cb raises - #155942

Open
danielKim614 wants to merge 1 commit into
python:mainfrom
danielKim614:gh-155941-streams-sync-cb
Open

gh-155941: Close the transport when a plain client_connected_cb raises#155942
danielKim614 wants to merge 1 commit into
python:mainfrom
danielKim614:gh-155941-streams-sync-cb

Conversation

@danielKim614

Copy link
Copy Markdown
Contributor

When a plain-function client_connected_cb passed to asyncio.start_server() raises, StreamReaderProtocol.connection_made() now reports the error via the loop exception handler and closes the transport, mirroring what gh-111601 (gh-110894) did for coroutine callbacks.

Previously the exception propagated out of connection_made(), so the server-side transport stayed open forever, leaking the connection and making Server.wait_closed() hang. The error was also reported with the generic callback message instead of "Unhandled exception in client_connected_cb".

The new test fails without the fix and passes with it. The full test_asyncio suite passes, including -R 3:3 refleak runs on test_streams.

cc. Pycon 2026 KR Sprint @hugovk @corona10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants