Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAB-11094 Fix deadlock in block iterator
The deliver service used to not close ledger iterators until after a block had been committed. With FAB-10799, the Deliver service more proactively cleans up ledger resources. This leads to a more likely contention between the block iterator's Close() function and the Next() function. These two code paths acquire the same two mutexes, but in different orders. The Next() path always acquires the itr.mgr.cpInfoCond.L first, then the itr.closeMarkerLock, while the Close() path inverts this order. If both Next() and Close() are invoked at the same time by goroutines, this can result in a deadlock where both mutexes lock and never unlock. This further prevents all blocks from committing and begins to leak memory resources. Change-Id: I99180fec2639a62cdf1cd9a6ce8b33f91ce498b9 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
- Loading branch information