Skip to content

Commit

Permalink
Capture seekerMgr instead Rlock (#3104)
Browse files Browse the repository at this point in the history
seekerMgr could change outside the lock, which might result in a nil
pointer
  • Loading branch information
ryanhall07 authored Jan 20, 2021
1 parent 142d35b commit bc5c2a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/dbnode/persist/fs/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,14 +568,15 @@ func (r *blockRetriever) seriesPresentInBloomFilter(
// Capture variable and RLock() because this slice can be modified in the
// Open() method
r.RLock()
seekerMgr := r.seekerMgr
r.RUnlock()

// This should never happen unless caller tries to use Stream() before Open()
if r.seekerMgr == nil {
r.RUnlock()
if seekerMgr == nil {
return false, errNoSeekerMgr
}
r.RUnlock()

idExists, err := r.seekerMgr.Test(id, shard, startTime)
idExists, err := seekerMgr.Test(id, shard, startTime)
if err != nil {
return false, err
}
Expand Down

0 comments on commit bc5c2a3

Please sign in to comment.