-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix issue where node connection map wasn't being pruned #4231
Conversation
🏎 |
nomad/client_rpc.go
Outdated
} | ||
} | ||
|
||
// If we just deleted the last conn, remove it from the map |
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.
If the last connection is deleted why is numConns ==1 and not 0?
nomad/client_rpc.go
Outdated
|
||
// If we just deleted the last conn, remove it from the map | ||
if found && numConns == 1 { | ||
delete(s.nodeConns, ctx.NodeID) |
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.
You could do the len
check and deletion right in the for
loop.
@@ -40,6 +40,11 @@ func (s *Server) getNodeConn(nodeID string) (*nodeConnState, bool) { | |||
} | |||
} | |||
|
|||
// Shouldn't happen but rather be safe |
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.
Can we dream up a reason this is possible? If not should we add a debug or trace log just in case it can help us find where an invariant is being broken.
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes #4230