Skip to content

Commit

Permalink
Fix CouchDB transaction manager lock issue
Browse files Browse the repository at this point in the history
The committer read/write lock was at wrong level, causing a lock that never
got unlocked during end-to-end trials.

Change-Id: I49b31207844b97f7e6f7e375450728a7ca71e7dd
Signed-off-by: denyeart <enyeart@us.ibm.com>
  • Loading branch information
denyeart committed Nov 7, 2016
1 parent 6ac4ed5 commit b53666d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/ledger/kvledger/txmgmt/couchdbtxmgmt/couchdb_txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ func (txmgr *CouchDBTxMgr) Commit() error {
panic("validateAndPrepare() method should have been called before calling commit()")
}

for k, v := range txmgr.updateSet.m {
txmgr.commitRWLock.Lock()
defer txmgr.commitRWLock.Unlock()
defer func() { txmgr.updateSet = nil }()

txmgr.commitRWLock.Lock()
defer txmgr.commitRWLock.Unlock()
defer func() { txmgr.updateSet = nil }()
for k, v := range txmgr.updateSet.m {

if couchdb.IsJSON(string(v.value)) {

Expand Down

0 comments on commit b53666d

Please sign in to comment.