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 for data race in memstore.LoadNextMsg #4552
Conversation
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.
On the whole I'm a bit nervous about releasing and relocking in this way as it can sometimes lead to subtle bugs or deadlocks, but short of refactoring this completely, this is probably the quickest fix.
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.
Is there a way to not do this?
Can we introduce a new func that expects the locks held?
I think the function already expects the write lock held, which is the issue. At that point we have a read lock and not a write lock. |
I think I would prefer, for now, to move the lock for LoadNextMsg to a write lock and then do a lock already held version of recalulateFirstForSubj(). |
14f0dc3
to
046d0b8
Compare
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
046d0b8
to
32021f6
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
Fix for a data race that was found in memory storage while working on a fix for #4551