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 race condition in clientHasMovedToDifferentAccount
#4561
Conversation
Signed-off-by: Neil Twigg <neil@nats.io>
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
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
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
server/reload.go
Outdated
@@ -2009,6 +2009,8 @@ func (s *Server) clientHasMovedToDifferentAccount(c *client) bool { | |||
nu *NkeyUser | |||
u *User | |||
) | |||
c.mu.Lock() | |||
defer c.mu.Unlock() | |||
if c.opts.Nkey != "" { |
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.
EMPTY
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.
Always a bugger 😄
Signed-off-by: Neil Twigg <neil@nats.io>
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.
Thanks.
Fixes #4560. The client lock needs to be held before accessing the
c.opts
.Signed-off-by: Neil Twigg neil@nats.io