trustbloc/fabric-peer-ext

Intermittent deadlock in ledger config

bstasyszyn opened this issue · 0 comments

During an endorsement if a chaincode invokes the ledger config service then an intermittent deadlock results. The scenario is as follows:

  • Chaincode is invoked (ledger read lock acquired)
  • Block is being committed (attempt to acquire write lock)
  • Chaincode invokes ledger config service (attempt to acquire read lock)
goroutine 23477 [semacquire, 13 minutes]:
sync.runtime_SemacquireMutex(0xc00226fa3c, 0xc007874500, 0x0)
	/usr/local/go/src/runtime/sema.go:71 +0x47
sync.(*RWMutex).RLock(...)
	/usr/local/go/src/sync/rwmutex.go:50
github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/txmgr.(*LockBasedTxMgr).NewQueryExecutor(0xc00226f9e0, 0xc007874510, 0x24, 0x4, 0xc002fdaff0, 0xc721d8, 0x10)
	/go/pkg/mod/github.com/trustbloc/fabric-mod@v0.1.4/core/ledger/kvledger/txmgmt/txmgr/lockbased_txmgr.go:149 +0xb8
github.com/hyperledger/fabric/core/ledger/kvledger.(*kvLedger).NewQueryExecutor(0xc000831810, 0xc00394c750, 0x10, 0x33268e0, 0xc00394c740)
	/go/pkg/mod/github.com/trustbloc/fabric-mod@v0.1.4/core/ledger/kvledger/kv_ledger.go:439 +0x47
github.com/trustbloc/fabric-peer-ext/pkg/config/ledgerconfig/service.(*qeProvider).GetQueryExecutorForLedger(0xc00283a870, 0xc002905010, 0xa, 0x231fd40, 0xc6e7bb, 0xc71966, 0xc721d8)
	/go/pkg/mod/github.com/trustbloc/fabric-peer-ext@v0.1.4/pkg/config/ledgerconfig/service/servicemgr.go:68 +0x36
github.com/trustbloc/fabric-peer-ext/pkg/config/ledgerconfig/state.(*QERetrieverProvider).GetStateRetriever(0xc00272de00, 0x0, 0x0, 0xc00786e4d0, 0x10)
	/go/pkg/mod/github.com/trustbloc/fabric-peer-ext@v0.1.4/pkg/config/ledgerconfig/state/qestateretriever.go:38 +0x49
github.com/trustbloc/fabric-peer-ext/pkg/config/ledgerconfig/mgr.(*QueryManager).query(0xc00272de20, 0xc007908ae0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/trustbloc/fabric-peer-ext@v0.1.4/pkg/config/ledgerconfig/mgr/querymgr.go:61 +0xaf
github.com/trustbloc/fabric-peer-ext/pkg/config/ledgerconfig/mgr.(*QueryManager).Query(0xc00272de20, 0xc007908ae0, 0x0, 0x0, 0x0, 0x18, 0x18)
	/go/pkg/mod/github.com/trustbloc/fabric-peer-ext@v0.1.4/pkg/config/ledgerconfig/mgr/querymgr.go:42 +0x154
github.com/trustbloc/fabric-peer-ext/pkg/config/ledgerconfig/service.(*ConfigService).Query(0xc00022d650, 0xc007908ae0, 0x7f03a50477d0, 0xc002fdb2f0, 0xcbc569, 0x17c06f0797b, 0x2c0f70cd)
	/go/pkg/mod/github.com/trustbloc/fabric-peer-ext@v0.1.4/pkg/config/ledgerconfig/service/service.go:104 +0x84