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

View File

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

View File

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

View File

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