-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 data race on mset.cfg #6424
Conversation
Note that we're seeing the errors in |
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 for this, just a small nit.
server/jetstream.go
Outdated
if SubjectsCollide(filter, subj) { | ||
msets = append(msets, mset) | ||
break | ||
func() { |
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.
Since we're doing a break
rather than an escaping return
, we don't really need the anonymous function closure here for defer
. We can just put the RUnlock
after the for
loop instead, which flattens it out a bit.
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.
Oop, yes! I got switched up and read the break
as in a different context than needs locking, but you're totally correct.
I've squashed the commit, since it doesn't seem that helpful to have one version and then the other.
Signed-off-by: Evan Anderson <evan@stacklok.com>
b4e27df
to
1606e03
Compare
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, thanks!
Will this be merged into the 2.10 branch as well? (Or is the next release 2.11.0?) |
Using NATS in our unit tests with the Go data race detector turned on, we sometimes see failures in
nats-server
like the following:Signed-off-by: Evan Anderson evan@stacklok.com