mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-25 11:11:18 -08:00
wgengine: do not terminate the process when in a debugger breakpoint
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 <[email protected]>
This commit is contained in:
1 file changed
+10
@@ -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())
|
||||
|
||||
Reference in new issue
Block a user