Browse Source

consensus: recover panics in receive routine

pull/611/head
Ethan Buchman 7 years ago
parent
commit
9ceccbe9a4
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      consensus/state.go

+ 6
- 0
consensus/state.go View File

@ -615,6 +615,12 @@ func (cs *ConsensusState) newStep() {
// Updates (state transitions) happen on timeouts, complete proposals, and 2/3 majorities. // Updates (state transitions) happen on timeouts, complete proposals, and 2/3 majorities.
// ConsensusState must be locked before any internal state is updated. // ConsensusState must be locked before any internal state is updated.
func (cs *ConsensusState) receiveRoutine(maxSteps int) { func (cs *ConsensusState) receiveRoutine(maxSteps int) {
defer func() {
if r := recover(); r != nil {
cs.Logger.Error("CONSENSUS FAILURE!!!", "err", r)
}
}()
for { for {
if maxSteps > 0 { if maxSteps > 0 {
if cs.nSteps >= maxSteps { if cs.nSteps >= maxSteps {


Loading…
Cancel
Save