stacks on task panic

This commit is contained in:
Andrew Jackson (Ajax) 2023-09-28 10:39:33 -05:00
parent 632bf15b82
commit 5a331e41a9

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"runtime"
"strconv" "strconv"
"sync/atomic" "sync/atomic"
"time" "time"
@ -121,8 +122,11 @@ top:
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
stackSlice := make([]byte, 512)
sz := runtime.Stack(stackSlice, false)
log.Error("Recovered from a serious error "+ log.Error("Recovered from a serious error "+
"while processing "+h.Name+" task "+strconv.Itoa(int(*tID))+": ", r) "while processing "+h.Name+" task "+strconv.Itoa(int(*tID))+": ", r,
" Stack: ", string(stackSlice[:sz]))
} }
h.Count.Add(-1) h.Count.Add(-1)