gh-156920, gh-156698: fix ProactorEventLoop datagram transport hangs on close() and after write errors - #156921
Open
graingert wants to merge 20 commits into
Open
gh-156920, gh-156698: fix ProactorEventLoop datagram transport hangs on close() and after write errors#156921graingert wants to merge 20 commits into
graingert wants to merge 20 commits into
Conversation
…red datagrams on close() and never call connection_lost()
…ror-hang # Conflicts: # Lib/test/test_asyncio/test_events.py
# Conflicts: # Lib/test/test_asyncio/test_events.py
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
# Conflicts: # Lib/asyncio/proactor_events.py
This reverts commit 4822ab7.
graingert
marked this pull request as ready for review
September 10, 2026 16:49
graingert
requested review from
1st1,
asvetlov,
kumaraditya303 and
willingc
as code owners
September 10, 2026 16:49
The from_callback variant only reaches the error path after the write has already been armed (and the protocol resumed), so it passes on main; fold the remaining scenario back into a single test.
Contributor
|
I think you need to add closing check otherwise any _loop_reading() that runs after close() now arms a fresh recvfrom on a closing transport. def _loop_reading(self, fut=None):
data = None
try:
if self._closing:
# close() no longer bumps _conn_lost while a write is still
# being flushed, so gate reads on _closing: after close()
# no more data will be received, and arming a recvfrom()
# here would leave an overlapped read to be aborted when
# connection_lost() closes the socket.
return |
Contributor
Author
|
@kumaraditya303 thanks for spotting that! |
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.
_ProactorDatagramTransportnever resumes a paused protocol after a write error #156698