-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delay Connection#onRemoved while pending #101910
Merged
DaveCTurner
merged 4 commits into
elastic:7.17
from
DaveCTurner:2023/11/08/testConcurrentConnectsAndCloses-7.17
Nov 9, 2023
Merged
Delay Connection#onRemoved while pending #101910
DaveCTurner
merged 4 commits into
elastic:7.17
from
DaveCTurner:2023/11/08/testConcurrentConnectsAndCloses-7.17
Nov 9, 2023
Conversation
This file contains 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
Today we call `Transport.Connection#onRemoved`, notifying any removed-listeners, when the connection is closed and removed from the `connectedNodes` map. However, it's possible for the connection to be closed while we're still adding it to the map and setting up the listeners, so this now-dead connection will still be found in the `pendingConnections` and may be returned to a future call to `connectToNode` even if this call was made after all the removed-listeners have been called. With this commit we delay calling the removed-listeners until the connection is closed and removed from both the `connectedNodes` and `pendingConnections` maps. Backport of elastic#92546 to 7.17 Relates elastic#100493
DaveCTurner
added
>bug
:Distributed Coordination/Network
Http and internode communication implementations
v7.17.15
labels
Nov 8, 2023
elasticsearchmachine
added
the
Team:Distributed
Meta label for distributed team (obsolete)
label
Nov 8, 2023
Hi @DaveCTurner, I've created a changelog YAML for you. |
Pinging @elastic/es-distributed (Team:Distributed) |
DaveCTurner
added
backport
auto-merge-without-approval
Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!)
labels
Nov 9, 2023
DaveCTurner
removed
the
auto-merge-without-approval
Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!)
label
Nov 9, 2023
Tim-Brooks
approved these changes
Nov 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
DaveCTurner
deleted the
2023/11/08/testConcurrentConnectsAndCloses-7.17
branch
November 9, 2023 19:53
DaveCTurner
added a commit
to DaveCTurner/elasticsearch
that referenced
this pull request
Nov 9, 2023
A call to `ConnectionTarget#connect` which happens strictly after all calls that close connections should leave us connected to the target. However concurrent calls to `ConnectionTarget#connect` can overlap, and today this means that a connection returned from an earlier call may overwrite one from a later call. The trouble is that the earlier connection attempt may yield a closed connection (it was concurrent with the disconnections) so we must not let it supersede the newer one. With this commit we prevent concurrent connection attempts, which avoids earlier attempts from overwriting the connections resulting from later attempts. Backport of elastic#92558 When combined with elastic#101910, closes elastic#100493
elasticsearchmachine
pushed a commit
that referenced
this pull request
Nov 9, 2023
A call to `ConnectionTarget#connect` which happens strictly after all calls that close connections should leave us connected to the target. However concurrent calls to `ConnectionTarget#connect` can overlap, and today this means that a connection returned from an earlier call may overwrite one from a later call. The trouble is that the earlier connection attempt may yield a closed connection (it was concurrent with the disconnections) so we must not let it supersede the newer one. With this commit we prevent concurrent connection attempts, which avoids earlier attempts from overwriting the connections resulting from later attempts. Backport of #92558 When combined with #101910, closes #100493
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport
>bug
:Distributed Coordination/Network
Http and internode communication implementations
Team:Distributed
Meta label for distributed team (obsolete)
v7.17.15
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.
Today we call
Transport.Connection#onRemoved
, notifying anyremoved-listeners, when the connection is closed and removed from the
connectedNodes
map. However, it's possible for the connection to beclosed while we're still adding it to the map and setting up the
listeners, so this now-dead connection will still be found in the
pendingConnections
and may be returned to a future call toconnectToNode
even if this call was made after all theremoved-listeners have been called.
With this commit we delay calling the removed-listeners until the
connection is closed and removed from both the
connectedNodes
andpendingConnections
maps.Backport of #92546 to 7.17
Relates #100493