Skip to content

Commit df9dd48

Browse files
committed
[FAB-8347] Fix re-entrant lock isuue
This CR fixes a re-entrant lock issue that happens during the block commit in the presence of pvt data Change-Id: I61b42a17c5b95e6411cf9698265b2d066a3ea26d Signed-off-by: manish <manish.sethi@gmail.com>
1 parent 661cb94 commit df9dd48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/lockbased_txmgr.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ func (txmgr *LockBasedTxMgr) Commit() error {
142142
}()
143143

144144
logger.Debugf("Committing updates to state database")
145-
txmgr.commitRWLock.Lock()
146-
logger.Debugf("Write lock acquired for committing updates to state database")
147145
if txmgr.current == nil {
148146
panic("validateAndPrepare() method should have been called before calling commit()")
149147
}
@@ -153,6 +151,8 @@ func (txmgr *LockBasedTxMgr) Commit() error {
153151
return err
154152
}
155153

154+
txmgr.commitRWLock.Lock()
155+
logger.Debugf("Write lock acquired for committing updates to state database")
156156
commitHeight := version.NewHeight(txmgr.current.blockNum(), txmgr.current.maxTxNumber())
157157
if err := txmgr.db.ApplyPrivacyAwareUpdates(txmgr.current.batch, commitHeight); err != nil {
158158
return err

0 commit comments

Comments
 (0)