Browse Source

add stacktrace to panic logs (#6662)

pull/6664/merge
Aleksandr Bezobchuk 3 years ago
committed by GitHub
parent
commit
1dec3e139a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 5 deletions
  1. +6
    -1
      internal/blockchain/v0/reactor.go
  2. +6
    -1
      internal/consensus/reactor.go
  3. +11
    -1
      internal/evidence/reactor.go
  4. +11
    -1
      internal/mempool/v0/reactor.go
  5. +11
    -1
      internal/mempool/v1/reactor.go
  6. +6
    -0
      internal/p2p/pex/reactor.go
  7. +6
    -0
      internal/statesync/reactor.go

+ 6
- 1
internal/blockchain/v0/reactor.go View File

@ -2,6 +2,7 @@ package v0
import ( import (
"fmt" "fmt"
"runtime/debug"
"sync" "sync"
"time" "time"
@ -265,7 +266,11 @@ func (r *Reactor) handleMessage(chID p2p.ChannelID, envelope p2p.Envelope) (err
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
err = fmt.Errorf("panic in processing message: %v", e) err = fmt.Errorf("panic in processing message: %v", e)
r.Logger.Error("recovering from processing message panic", "err", err)
r.Logger.Error(
"recovering from processing message panic",
"err", err,
"stack", string(debug.Stack()),
)
} }
}() }()


+ 6
- 1
internal/consensus/reactor.go View File

@ -2,6 +2,7 @@ package consensus
import ( import (
"fmt" "fmt"
"runtime/debug"
"time" "time"
cstypes "github.com/tendermint/tendermint/internal/consensus/types" cstypes "github.com/tendermint/tendermint/internal/consensus/types"
@ -1207,7 +1208,11 @@ func (r *Reactor) handleMessage(chID p2p.ChannelID, envelope p2p.Envelope) (err
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
err = fmt.Errorf("panic in processing message: %v", e) err = fmt.Errorf("panic in processing message: %v", e)
r.Logger.Error("recovering from processing message panic", "err", err)
r.Logger.Error(
"recovering from processing message panic",
"err", err,
"stack", string(debug.Stack()),
)
} }
}() }()


+ 11
- 1
internal/evidence/reactor.go View File

@ -2,6 +2,7 @@ package evidence
import ( import (
"fmt" "fmt"
"runtime/debug"
"sync" "sync"
"time" "time"
@ -165,6 +166,11 @@ func (r *Reactor) handleMessage(chID p2p.ChannelID, envelope p2p.Envelope) (err
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
err = fmt.Errorf("panic in processing message: %v", e) err = fmt.Errorf("panic in processing message: %v", e)
r.Logger.Error(
"recovering from processing message panic",
"err", err,
"stack", string(debug.Stack()),
)
} }
}() }()
@ -296,7 +302,11 @@ func (r *Reactor) broadcastEvidenceLoop(peerID types.NodeID, closer *tmsync.Clos
r.peerWG.Done() r.peerWG.Done()
if e := recover(); e != nil { if e := recover(); e != nil {
r.Logger.Error("recovering from broadcasting evidence loop", "err", e)
r.Logger.Error(
"recovering from broadcasting evidence loop",
"err", e,
"stack", string(debug.Stack()),
)
} }
}() }()


+ 11
- 1
internal/mempool/v0/reactor.go View File

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"runtime/debug"
"sync" "sync"
"time" "time"
@ -188,6 +189,11 @@ func (r *Reactor) handleMessage(chID p2p.ChannelID, envelope p2p.Envelope) (err
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
err = fmt.Errorf("panic in processing message: %v", e) err = fmt.Errorf("panic in processing message: %v", e)
r.Logger.Error(
"recovering from processing message panic",
"err", err,
"stack", string(debug.Stack()),
)
} }
}() }()
@ -312,7 +318,11 @@ func (r *Reactor) broadcastTxRoutine(peerID types.NodeID, closer *tmsync.Closer)
r.peerWG.Done() r.peerWG.Done()
if e := recover(); e != nil { if e := recover(); e != nil {
r.Logger.Error("recovering from broadcasting mempool loop", "err", e)
r.Logger.Error(
"recovering from broadcasting mempool loop",
"err", e,
"stack", string(debug.Stack()),
)
} }
}() }()


+ 11
- 1
internal/mempool/v1/reactor.go View File

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"runtime/debug"
"sync" "sync"
"time" "time"
@ -187,6 +188,11 @@ func (r *Reactor) handleMessage(chID p2p.ChannelID, envelope p2p.Envelope) (err
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
err = fmt.Errorf("panic in processing message: %v", e) err = fmt.Errorf("panic in processing message: %v", e)
r.Logger.Error(
"recovering from processing message panic",
"err", err,
"stack", string(debug.Stack()),
)
} }
}() }()
@ -311,7 +317,11 @@ func (r *Reactor) broadcastTxRoutine(peerID types.NodeID, closer *tmsync.Closer)
r.peerWG.Done() r.peerWG.Done()
if e := recover(); e != nil { if e := recover(); e != nil {
r.Logger.Error("recovering from broadcasting mempool loop", "err", e)
r.Logger.Error(
"recovering from broadcasting mempool loop",
"err", e,
"stack", string(debug.Stack()),
)
} }
}() }()


+ 6
- 0
internal/p2p/pex/reactor.go View File

@ -3,6 +3,7 @@ package pex
import ( import (
"context" "context"
"fmt" "fmt"
"runtime/debug"
"sync" "sync"
"time" "time"
@ -367,6 +368,11 @@ func (r *ReactorV2) handleMessage(chID p2p.ChannelID, envelope p2p.Envelope) (er
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
err = fmt.Errorf("panic in processing message: %v", e) err = fmt.Errorf("panic in processing message: %v", e)
r.Logger.Error(
"recovering from processing message panic",
"err", err,
"stack", string(debug.Stack()),
)
} }
}() }()


+ 6
- 0
internal/statesync/reactor.go View File

@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"reflect" "reflect"
"runtime/debug"
"sort" "sort"
"time" "time"
@ -644,6 +645,11 @@ func (r *Reactor) handleMessage(chID p2p.ChannelID, envelope p2p.Envelope) (err
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
err = fmt.Errorf("panic in processing message: %v", e) err = fmt.Errorf("panic in processing message: %v", e)
r.Logger.Error(
"recovering from processing message panic",
"err", err,
"stack", string(debug.Stack()),
)
} }
}() }()


Loading…
Cancel
Save