vtworker: Log head of stacktrace in case of a panic.

This commit is contained in:
Michael Berlin 2016-04-26 23:52:06 -07:00
Родитель dd05dec73c
Коммит faa3f2f2c2
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -14,6 +14,7 @@ import (
"time"
log "github.com/golang/glog"
"github.com/youtube/vitess/go/tb"
"github.com/youtube/vitess/go/vt/logutil"
vtrpcpb "github.com/youtube/vitess/go/vt/proto/vtrpc"
"github.com/youtube/vitess/go/vt/tabletmanager/tmclient"
@ -119,7 +120,8 @@ func (wi *Instance) setAndStartWorker(wrk Worker, wr *wrangler.Wrangler) (chan s
defer func() {
// The recovery code is a copy of servenv.HandlePanic().
if x := recover(); x != nil {
err = fmt.Errorf("uncaught %v panic: %v", "vtworker", x)
log.Errorf("uncaught vtworker panic: %v\n%s", x, tb.Stack(4))
err = fmt.Errorf("uncaught vtworker panic: %v", x)
}
wi.currentWorkerMutex.Lock()