Skip to content

Commit

Permalink
fix runlock bug
Browse files Browse the repository at this point in the history
  • Loading branch information
leoyang.yl authored and michaljasionowski committed Dec 16, 2021
1 parent 73080a7 commit 55c16df
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 55c16df

Please sign in to comment.