Skip to content

Commit

Permalink
Fix for data race in memstore.LoadNextMsg
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
  • Loading branch information
wallyqs committed Sep 17, 2023
1 parent 6f38056 commit 14f0dc3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/memstore.go
Expand Up @@ -952,7 +952,11 @@ func (ms *memStore) LoadNextMsg(filter string, wc bool, start uint64, smp *Store
continue
}
if ss.firstNeedsUpdate {
ms.mu.RUnlock()
ms.mu.Lock()
ms.recalculateFirstForSubj(subj, ss.First, ss)
ms.mu.Unlock()
ms.mu.RLock()
}
if ss.First < fseq {
fseq = ss.First
Expand Down

0 comments on commit 14f0dc3

Please sign in to comment.