From b527c9c7183cab2323170e6fb80fef9cf1c63b35 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 2 Oct 2015 12:20:18 +0200 Subject: [PATCH] core: deadlock in chainmanager after posting RemovedTransactionEvent This PR solves an issue with the chain manager posting a `RemovedTransactionEvent`, the tx pool will try to acquire the chainmanager lock which has previously been locked prior to posting `RemovedTransactionEvent`. This results in a deadlock in the core. --- core/chain_manager.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/chain_manager.go b/core/chain_manager.go index 383fce70c8..9525e23982 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -804,7 +804,9 @@ func (self *ChainManager) reorg(oldBlock, newBlock *types.Block) error { DeleteReceipt(self.chainDb, tx.Hash()) DeleteTransaction(self.chainDb, tx.Hash()) } - self.eventMux.Post(RemovedTransactionEvent{diff}) + // Must be posted in a goroutine because of the transaction pool trying + // to acquire the chain manager lock + go self.eventMux.Post(RemovedTransactionEvent{diff}) return nil }