From 5a331e41a9f7e9a32031869eecacbea00b281353 Mon Sep 17 00:00:00 2001 From: "Andrew Jackson (Ajax)" Date: Thu, 28 Sep 2023 10:39:33 -0500 Subject: [PATCH] stacks on task panic --- lib/harmony/harmonytask/task_type_handler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/harmony/harmonytask/task_type_handler.go b/lib/harmony/harmonytask/task_type_handler.go index 3f970a90e..a05cb8fa0 100644 --- a/lib/harmony/harmonytask/task_type_handler.go +++ b/lib/harmony/harmonytask/task_type_handler.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "net/http" + "runtime" "strconv" "sync/atomic" "time" @@ -121,8 +122,11 @@ top: defer func() { if r := recover(); r != nil { + stackSlice := make([]byte, 512) + sz := runtime.Stack(stackSlice, false) 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)