Skip to content

Commit 6818fb1

Browse files
committed
fix goroutine label
1 parent 2c77b8a commit 6818fb1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/queue/workerqueue.go

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package queue
66
import (
77
"context"
88
"fmt"
9+
"runtime/pprof"
910
"sync"
1011
"sync/atomic"
1112
"time"
@@ -241,6 +242,9 @@ func NewWorkerPoolQueueWithContext[T any](ctx context.Context, name string, queu
241242
w.origHandler = handler
242243
w.safeHandler = func(t ...T) (unhandled []T) {
243244
defer func() {
245+
// FIXME: there is no ctx support in the handler, so process manager is unable to restore the labels
246+
// so here we explicitly set the "queue ctx" labels again after the handler is done
247+
pprof.SetGoroutineLabels(w.ctxRun)
244248
err := recover()
245249
if err != nil {
246250
log.Error("Recovered from panic in queue %q handler: %v\n%s", name, err, log.Stack(2))

0 commit comments

Comments
 (0)