Close connection comm on retry - #3365
Merged
Merged
Conversation
Member
|
This seems fine to me. Should we swap out cc also @jcrist , who has been interested in tornado/asyncio switching code in the past. |
Member
|
Also, thanks for hunting this down @jrbourbeau ! |
Member
|
This looks good to me, thanks @jrbourbeau.
I think we should strive for that, but because it has different semantics replacing it isn't always straightforward. Each case needs to be examined to determine what the intent was and if the lack of cancellation was accidental or necessary. |
Member
|
Oop, just saw you marked this as |
Member
Author
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.
Currently when making new comm connections, we do so with
gen.with_timeoutheredistributed/distributed/comm/core.py
Lines 215 to 219 in baf5903
and retry the connection if a timeout is reached. However,
gen.with_timeoutdoes not cancel a task when it's timeout expires. Not cancelling these tasks can lead to a "Closing dangling stream" warning being raised heredistributed/distributed/comm/tcp.py
Line 169 in baf5903
when
TCPclass instances from previously timed out connection task are garbage collected.Switching to
asyncio.wait_forallows us to keep a similar timeout-then-retry connection behavior, but also cancels a connection task if a timeout occurs.This is just one proposed improvement to the situation. Alternatively we could make the currently hardcoded 1s in the timeout configurable.