Skip to content

gh-155934: Fix socket leak and silent error for asyncio accepted connections - #155936

Merged
kumaraditya303 merged 3 commits into
python:mainfrom
danielKim614:gh-155934-accept-error
Aug 23, 2026
Merged

gh-155934: Fix socket leak and silent error for asyncio accepted connections#155936
kumaraditya303 merged 3 commits into
python:mainfrom
danielKim614:gh-155934-accept-error

Conversation

@danielKim614

@danielKim614 danielKim614 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

When protocol_factory() or transport creation raises for an accepted connection in BaseSelectorEventLoop._accept_connection2(), close the accepted socket (it would otherwise leak until garbage collection) and report the error via the loop exception handler even when debug mode is disabled.

Reporting stays debug-only once the transport exists, so await waiter failures such as SSL handshake errors from port scanners are not reported unconditionally.

This is the server-side counterpart of gh-153134 (GH-153133).

The new tests fail without the fix and pass with it. The full test_asyncio suite passes, including -R 3:3 refleak runs on test_selector_events.

cc. Pycon 2026 KR Sprint @hugovk @corona10

@python-cla-bot

python-cla-bot Bot commented Aug 22, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Aug 23, 2026
@kumaraditya303
kumaraditya303 enabled auto-merge (squash) August 23, 2026 09:49
@kumaraditya303
kumaraditya303 merged commit 1461f04 into python:main Aug 23, 2026
55 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sprint 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