Repository navigation
Conversation
…ction reset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
asvetlov
marked this pull request as ready for review
November 3, 2026 16:03
asvetlov
requested review from
1st1,
kumaraditya303 and
willingc
as code owners
November 3, 2026 16:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, a client that resets its connection while it waits in the listen queue makes the pending
AcceptExfail withERROR_NETNAME_DELETED(WinError 64).BaseProactorEventLoop._start_servingtreated everyOSErroras fatal for the listening socket and closed it. After that the server refused all new connections, whileServer.is_serving()still returnedTrue.Changes:
IocpProactor.accept()closes the accept socket whenAcceptExfails, and turnsERROR_NETNAME_DELETEDintoConnectionResetError, asrecv()and friends already do.accept_corono longer re-raises that error: the caller already receives it through the future, so re-raising only logged a second "Task exception was never retrieved" traceback.ConnectionResetErrorandConnectionAbortedErroras per-connection errors: it logs them at debug level and keeps accepting, asSelectorEventLoop._accept_connectionalready does. OtherOSErrors still close the listening socket.Tests:
test_windows_events.test_accept_connection_resetreproduces the bug reliably, using the reproducer from the issue: two connections are made while the loop is blocked, and the second is reset in the listen queue. On a Windows 11 debug build it failed 3 times out of 3 without the fix (WinError 64, thenConnectionRefusedError) and passed 10 times out of 10 with it. The fulltest_asynciosuite passes on Windows.test_proactor_events.test_create_server_connection_resetcovers the serving-loop change with mocks.Notes for reviewers:
ERROR_OPERATION_ABORTED, which usually means the listening socket itself was closed. That error isn't mapped here.ConnectionResetErrorstill reaches theexcept OSErrorbranch, which closes the listener.🤖 Generated with Claude Code