Skip to content

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

Merged
kumaraditya303 merged 1 commit into
python:mainfrom
danielKim614:gh-155941-streams-sync-cb
Aug 18, 2026
Merged

gh-155941: Close the transport when a plain client_connected_cb raises#155942
kumaraditya303 merged 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

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Aug 18, 2026
@kumaraditya303
kumaraditya303 merged commit 95e32ba into python:main Aug 18, 2026
59 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sprint Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants