-
Notifications
You must be signed in to change notification settings - Fork 981
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
Simplify getting a hostinfo or starting a handshake with one #954
Merged
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
nbrownus
force-pushed
the
no-cert-state
branch
from
August 15, 2023 02:35
faa655a
to
d01cb2f
Compare
nbrownus
force-pushed
the
getOrHandshake
branch
from
August 15, 2023 02:40
48d00f1
to
3656e8c
Compare
wadey
previously approved these changes
Aug 15, 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.
I think overall this looks good. I do see some races that could still happen due to the transition from handshakeManager to main hostmap, but I dont think there is an easy way to solve them unless we only had one map that contained both pending and active.
nbrownus
force-pushed
the
getOrHandshake
branch
from
August 21, 2023 19:12
3656e8c
to
95da1f6
Compare
wadey
approved these changes
Aug 21, 2023
wadey
added a commit
that referenced
this pull request
May 28, 2024
We had a rare deadlock in GetOrHandshake because we kept the hostmap lock when we do the call to StartHandshake. StartHandshake can block while sending to the lighthouse query worker channel, and that worker needs to be able to grab the hostmap lock to do its work. Other calls for StartHandshake don't hold the hostmap lock so we should be able to drop it here. This lock was originally added with: #954
wadey
added a commit
that referenced
this pull request
May 29, 2024
We had a rare deadlock in GetOrHandshake because we kept the hostmap lock when we do the call to StartHandshake. StartHandshake can block while sending to the lighthouse query worker channel, and that worker needs to be able to grab the hostmap lock to do its work. Other calls for StartHandshake don't hold the hostmap lock so we should be able to drop it here. This lock was originally added with: #954
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.
This PR is based on #953. The base branch will be changed to
master
when it merges.The goal here is to simplify getting a hostinfo and starting a handshake, paving the way to invert how handshake state is tracked so that we don't have to keep all of it around in a fully formed hostinfo.
This should also resolve the last remaining racy issues with interactions between the pending and main hostmap.
There are 2 trouble spots here.
HandshakeManager.allocateIndex
acquires a main hostmap read lock and a pending hostmap write lock while it holds a hostinfo lock. I haven't found anywhere where that order is violated yet but it's worth some extra eyes.handshake_ix.go
is inherently racy, I think it's a little better now than it was before but solving it entirely requires inverting the interactions withHandshakeManager
.