Skip to content

Commit

Permalink
eth: close engine before handler for graceful shutdown (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
manav2401 authored Apr 15, 2024
1 parent ffe810e commit f6969db
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand Down

0 comments on commit f6969db

Please sign in to comment.