From 9ceccbe9a42266d35d0ceab48cfb62b329b84554 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Wed, 16 Aug 2017 01:01:09 -0400 Subject: [PATCH] consensus: recover panics in receive routine --- consensus/state.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/consensus/state.go b/consensus/state.go index 48c91d27..f6ee5d45 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -615,6 +615,12 @@ func (cs *ConsensusState) newStep() { // Updates (state transitions) happen on timeouts, complete proposals, and 2/3 majorities. // ConsensusState must be locked before any internal state is updated. func (cs *ConsensusState) receiveRoutine(maxSteps int) { + defer func() { + if r := recover(); r != nil { + cs.Logger.Error("CONSENSUS FAILURE!!!", "err", r) + } + }() + for { if maxSteps > 0 { if cs.nSteps >= maxSteps {