mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Log task goroutine IDs in the sentry watchdog.
PiperOrigin-RevId: 342373580
This commit is contained in:
@@ -390,6 +390,11 @@ func (t *Task) assertTaskGoroutine() {
|
||||
}
|
||||
}
|
||||
|
||||
// GoroutineID returns the ID of t's task goroutine.
|
||||
func (t *Task) GoroutineID() int64 {
|
||||
return atomic.LoadInt64(&t.goid)
|
||||
}
|
||||
|
||||
// waitGoroutineStoppedOrExited blocks until t's task goroutine stops or exits.
|
||||
func (t *Task) waitGoroutineStoppedOrExited() {
|
||||
t.goroutineStopped.Wait()
|
||||
|
||||
@@ -336,11 +336,9 @@ func (w *Watchdog) report(offenders map[*kernel.Task]*offender, newTaskFound boo
|
||||
buf.WriteString(fmt.Sprintf("Sentry detected %d stuck task(s):\n", len(offenders)))
|
||||
for t, o := range offenders {
|
||||
tid := w.k.TaskSet().Root.IDOfTask(t)
|
||||
buf.WriteString(fmt.Sprintf("\tTask tid: %v (%#x), entered RunSys state %v ago.\n", tid, uint64(tid), now.Sub(o.lastUpdateTime)))
|
||||
buf.WriteString(fmt.Sprintf("\tTask tid: %v (goroutine %d), entered RunSys state %v ago.\n", tid, t.GoroutineID(), now.Sub(o.lastUpdateTime)))
|
||||
}
|
||||
|
||||
buf.WriteString("Search for '(*Task).run(0x..., 0x<tid>)' in the stack dump to find the offending goroutine")
|
||||
|
||||
// Force stack dump only if a new task is detected.
|
||||
w.doAction(w.TaskTimeoutAction, newTaskFound, &buf)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user