summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/watchdog
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-06-21 19:55:06 +0000
committergVisor bot <gvisor-bot@google.com>2019-06-21 19:55:06 +0000
commita131bb04290ba632856348bfdedf7b6525b0d530 (patch)
tree20d09a7cdb845753d2cb62dd7c067083614a61e7 /pkg/sentry/watchdog
parentfd1a65eddff66bf9ee8bdac2e00948f6784b7c1c (diff)
parent5ba16d51a950d55684c0348a9445784363467c9c (diff)
Merge 5ba16d51 (automated)
Diffstat (limited to 'pkg/sentry/watchdog')
-rw-r--r--pkg/sentry/watchdog/watchdog.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/sentry/watchdog/watchdog.go b/pkg/sentry/watchdog/watchdog.go
index d0d2a4d5f..145102c0d 100644
--- a/pkg/sentry/watchdog/watchdog.go
+++ b/pkg/sentry/watchdog/watchdog.go
@@ -271,23 +271,23 @@ func (w *Watchdog) reportStuckWatchdog() {
w.onStuckTask(true, &buf)
}
-func (w *Watchdog) onStuckTask(newTaskFound bool, buf *bytes.Buffer) {
+func (w *Watchdog) onStuckTask(newTaskFound bool, msg *bytes.Buffer) {
switch w.timeoutAction {
case LogWarning:
// Dump stack only if a new task is detected or if it sometime has passed since
// the last time a stack dump was generated.
if !newTaskFound && time.Since(w.lastStackDump) < stackDumpSameTaskPeriod {
- buf.WriteString("\n...[stack dump skipped]...")
- log.Warningf(buf.String())
+ msg.WriteString("\n...[stack dump skipped]...")
+ log.Warningf(msg.String())
} else {
- log.TracebackAll(buf.String())
+ log.TracebackAll(msg.String())
w.lastStackDump = time.Now()
}
case Panic:
// Panic will skip over running tasks, which is likely the culprit here. So manually
// dump all stacks before panic'ing.
- log.TracebackAll(buf.String())
+ log.TracebackAll(msg.String())
// Attempt to flush metrics, timeout and move on in case metrics are stuck as well.
metricsEmitted := make(chan struct{}, 1)
@@ -300,6 +300,6 @@ func (w *Watchdog) onStuckTask(newTaskFound bool, buf *bytes.Buffer) {
case <-metricsEmitted:
case <-time.After(1 * time.Second):
}
- panic("Sentry detected stuck task(s). See stack trace and message above for more details")
+ panic(fmt.Sprintf("Stack for running G's are skipped while panicking.\n%s", msg.String()))
}
}