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
@danielKim614

Copy link
Copy Markdown
Contributor Author

@kumaraditya303 Should this be backported to 3.13 and 3.14?
The bug is present there as well, and the leaked connection also makes Server.wait_closed() hang.
Happy to resolve the conflicts manually if the bot backports fail.

@kumaraditya303 kumaraditya303 added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 23, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @danielKim614 for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @danielKim614 for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-app

bedevere-app Bot commented Aug 23, 2026

Copy link
Copy Markdown

GH-156273 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 23, 2026
@bedevere-app

bedevere-app Bot commented Aug 23, 2026

Copy link
Copy Markdown

GH-156274 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 23, 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