mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-04 23:45:34 +00: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 <james@tailscale.com>
This commit is contained in:
parent
12f8c98823
commit
e09e8d0701
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user