diff options
| author | James Tucker <james@tailscale.com> | 2023-06-07 15:38:05 -0700 |
|---|---|---|
| committer | James Tucker <james@tailscale.com> | 2023-06-07 15:50:31 -0700 |
| commit | e09e8d070135374c8f5969987d99a0b74803741a (patch) | |
| tree | 1eec686e6b2524382341ee849099fa292b596752 | |
| parent | 12f8c988230bbe33ba2a2a00d16540b0f9b9c605 (diff) | |
| download | tailscale-raggi/tsdebugger.tar.xz tailscale-raggi/tsdebugger.zip | |
wgengine: do not terminate the process when in a debugger breakpointraggi/tsdebugger
The watchdog attempts to check if an operation has locked up, but this
happens as a natural course of running under a debugger. The output is
noisy, and the final operation is fatal. Replace that with a short
output instead when $TS_DEBUGGER is set.
Fixes #8301
Signed-off-by: James Tucker <james@tailscale.com>
| -rw-r--r-- | wgengine/watchdog.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/wgengine/watchdog.go b/wgengine/watchdog.go index 19505be89..1e726e990 100644 --- a/wgengine/watchdog.go +++ b/wgengine/watchdog.go @@ -60,6 +60,11 @@ type watchdogEngine struct { inFlightCtr uint64 } +// inDebugger returns true if the process has $TS_DEBUGGER set. This should be +// used to avoid terminating the process when operations take an unusual amount +// of time, as would be caused by a debugger breakpoint. +var inDebugger = envknob.RegisterBool("TS_DEBUGGER") + func (e *watchdogEngine) watchdogErr(name string, fn func() error) error { // Track all in-flight operations so we can print more useful error // messages on watchdog failure @@ -88,6 +93,11 @@ func (e *watchdogEngine) watchdogErr(name string, fn func() error) error { t.Stop() return err case <-t.C: + if inDebugger() { + e.logf("wgengine: watchdog timeout on %s (in debugger, maybe process was frozen?)", name) + return nil + } + buf := new(strings.Builder) pprof.Lookup("goroutine").WriteTo(buf, 1) e.logf("wgengine watchdog stacks:\n%s", buf.String()) |
