Documentation ¶
Overview ¶
Package watchdog is responsible for monitoring the sentry for tasks that may potentially be stuck or looping inderterminally causing hard to debug hungs in the untrusted app.
It works by periodically querying all tasks to check whether they are in user mode (RunUser), kernel mode (RunSys), or blocked in the kernel (OffCPU). Tasks that have been running in kernel mode for a long time in the same syscall without blocking are considered stuck and are reported.
When a stuck task is detected, the watchdog can take one of the following actions:
- LogWarning: Logs a warning message followed by a stack dump of all goroutines. If a tasks continues to be stuck, the message will repeat every minute, unless a new stuck task is detected
- Panic: same as above, followed by panic()
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOpts = Opts{ TaskTimeout: 3 * time.Minute, TaskTimeoutAction: LogWarning, StartupTimeout: 30 * time.Second, StartupTimeoutAction: LogWarning, }
DefaultOpts is a default set of options for the watchdog.
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct { // TaskTimeout is the amount of time to allow a task to execute the // same syscall without blocking before it's declared stuck. TaskTimeout time.Duration // TaskTimeoutAction indicates what action to take when a stuck tasks // is detected. TaskTimeoutAction Action // StartupTimeout is the amount of time to allow between watchdog // creation and calling watchdog.Start. StartupTimeout time.Duration // StartupTimeoutAction indicates what action to take when // watchdog.Start is not called within the timeout. StartupTimeoutAction Action }
Opts configures the watchdog.
Click to show internal directories.
Click to hide internal directories.