Skip to content

Commit

Permalink
Merge pull request #13541 from michaljasionowski/backport-runlock-fix
Browse files Browse the repository at this point in the history
Backport watchablestore runlock bug fix to release-3.5
  • Loading branch information
ptabor authored Dec 21, 2021
2 parents 73080a7 + 55c16df commit 7291ed3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/mvcc/watchable_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,11 @@ func (s *watchableStore) syncWatchers() int {
tx := s.store.b.ReadTx()
tx.RLock()
revs, vs := tx.UnsafeRange(buckets.Key, minBytes, maxBytes, 0)
tx.RUnlock()
evs := kvsToEvents(s.store.lg, wg, revs, vs)
// Must unlock after kvsToEvents, because vs (come from boltdb memory) is not deep copy.
// We can only unlock after Unmarshal, which will do deep copy.
// Otherwise we will trigger SIGSEGV during boltdb re-mmap.
tx.RUnlock()

var victims watcherBatch
wb := newWatcherBatch(wg, evs)
Expand Down

0 comments on commit 7291ed3

Please sign in to comment.