From 1eea12d177931bb1ae4917a5a79a0ec1dae444a9 Mon Sep 17 00:00:00 2001 From: Yogendra Acharya Date: Fri, 10 Dec 2021 20:29:02 +0530 Subject: [PATCH] MB-50034: Potential deadlock in MOI.doPersistSnapshot RWMutex RUnlock call is missing. This is a regression introduced with MB-46507 [Backport] - [System test Upgrade] - Negative values returned for stat raw_data_size post upgrade Due to missing unlock index main loop will get stuck and cause multiple issues such as failed rebalance, indexer flush stuck etc. Fix: release acquired mutex. Change-Id: I3c934654e16d874a46fe536a507034bae27f6545 --- secondary/indexer/memdb_slice_impl.go | 1 + 1 file changed, 1 insertion(+) diff --git a/secondary/indexer/memdb_slice_impl.go b/secondary/indexer/memdb_slice_impl.go index c7f0d7b00..468344292 100644 --- a/secondary/indexer/memdb_slice_impl.go +++ b/secondary/indexer/memdb_slice_impl.go @@ -963,6 +963,7 @@ func (mdb *memdbSlice) doPersistSnapshot(s *memdbSnapshot) { os.RemoveAll(tmpdir) mdb.confLock.RLock() maxThreads := mdb.sysconf["settings.moi.persistence_threads"].Int() + mdb.confLock.RUnlock() total := atomic.LoadInt64(&totalMemDBItems) indexCount := mdb.GetCommittedCount() // Compute number of workers to be used for taking backup