print stack trace on panic recovery (#2042)

This commit is contained in:
Preston Van Loon 2019-03-20 10:17:44 -04:00 committed by GitHub
parent 4a2ef17be1
commit 7f11cbd5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"math/big" "math/big"
"runtime/debug"
"strings" "strings"
"time" "time"
@ -268,6 +269,8 @@ func safelyHandlePanic() {
log.WithFields(logrus.Fields{ log.WithFields(logrus.Fields{
"r": r, "r": r,
}).Error("Panicked when handling data from ETH 1.0 Chain! Recovering...") }).Error("Panicked when handling data from ETH 1.0 Chain! Recovering...")
debug.PrintStack()
} }
} }

View File

@ -14,6 +14,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"runtime/debug"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -250,6 +251,8 @@ func safelyHandleMessage(fn func(p2p.Message), msg p2p.Message) {
"msg": printedMsg, "msg": printedMsg,
}).Error("Panicked when handling p2p message! Recovering...") }).Error("Panicked when handling p2p message! Recovering...")
debug.PrintStack()
if msg.Ctx == nil { if msg.Ctx == nil {
return return
} }

View File

@ -4,6 +4,7 @@ package sync
import ( import (
"context" "context"
"fmt" "fmt"
"runtime/debug"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
@ -241,6 +242,8 @@ func safelyHandleMessage(fn func(p2p.Message), msg p2p.Message) {
"msg": printedMsg, "msg": printedMsg,
}).Error("Panicked when handling p2p message! Recovering...") }).Error("Panicked when handling p2p message! Recovering...")
debug.PrintStack()
if msg.Ctx == nil { if msg.Ctx == nil {
return return
} }

View File

@ -3,6 +3,7 @@ package messagehandler
import ( import (
"context" "context"
"fmt" "fmt"
"runtime/debug"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -25,6 +26,8 @@ func SafelyHandleMessage(ctx context.Context, fn func(ctx context.Context, messa
"msg": printedMsg, "msg": printedMsg,
}).Error("Panicked when handling p2p message! Recovering...") }).Error("Panicked when handling p2p message! Recovering...")
debug.PrintStack()
if ctx == nil { if ctx == nil {
return return
} }