diff --git a/eth/backend.go b/eth/backend.go index 3d18c71ac3..a7776df447 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -822,6 +822,12 @@ func (s *Ethereum) Stop() error { // Stop all the peer-related stuff first. s.ethDialCandidates.Close() s.snapDialCandidates.Close() + + // Close the engine before handler else it may cause a deadlock where + // the heimdall is unresponsive and the syncing loop keeps waiting + // for a response and is unable to proceed to exit `Finalize` during + // block processing. + s.engine.Close() s.handler.Stop() // Then stop everything else. @@ -834,7 +840,6 @@ func (s *Ethereum) Stop() error { s.txPool.Close() s.miner.Close() s.blockchain.Stop() - s.engine.Close() // Clean shutdown marker as the last thing before closing db s.shutdownTracker.Stop()