Skip to content
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

Merged
merged 2 commits into from Sep 19, 2023

Conversation

neilalexander
Copy link
Member

Fixes #4560. The client lock needs to be held before accessing the c.opts.

Signed-off-by: Neil Twigg neil@nats.io

Signed-off-by: Neil Twigg <neil@nats.io>
@neilalexander neilalexander requested a review from a team as a code owner September 19, 2023 17:53
Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@bruth bruth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@derekcollison derekcollison left a 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 != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EMPTY

Copy link
Member

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>
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@neilalexander neilalexander merged commit 271b648 into main Sep 19, 2023
2 checks passed
@neilalexander neilalexander deleted the neil/reloadrace branch September 19, 2023 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Race condition in reloading config at reload.go:2012
4 participants