diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2019-11-01 11:44:07 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-11-01 11:49:31 -0700 |
commit | e70f28664af53b0428405c695c90a91b9bb43f67 (patch) | |
tree | 58b30d547d2737fcfb96164b9bd072d86cf20aa9 /runsc/boot | |
parent | 5694bd080e0e95ba18cbf77038f450fe33b9f8df (diff) |
Allow the watchdog to detect when the sandbox is stuck during setup.
The watchdog currently can find stuck tasks, but has no way to tell if the
sandbox is stuck before the application starts executing.
This CL adds a startup timeout and action to the watchdog. If Start() is not
called before the given timeout (if non-zero), then the watchdog will take the
action.
PiperOrigin-RevId: 277970577
Diffstat (limited to 'runsc/boot')
-rw-r--r-- | runsc/boot/controller.go | 4 | ||||
-rw-r--r-- | runsc/boot/loader.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/runsc/boot/controller.go b/runsc/boot/controller.go index 928285683..f62be4c59 100644 --- a/runsc/boot/controller.go +++ b/runsc/boot/controller.go @@ -380,7 +380,9 @@ func (cm *containerManager) Restore(o *RestoreOpts, _ *struct{}) error { } // Since we have a new kernel we also must make a new watchdog. - dog := watchdog.New(k, watchdog.DefaultTimeout, cm.l.conf.WatchdogAction) + dogOpts := watchdog.DefaultOpts + dogOpts.TaskTimeoutAction = cm.l.conf.WatchdogAction + dog := watchdog.New(k, dogOpts) // Change the loader fields to reflect the changes made when restoring. cm.l.k = k diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go index 86df384f8..4d1bd2d08 100644 --- a/runsc/boot/loader.go +++ b/runsc/boot/loader.go @@ -300,7 +300,9 @@ func New(args Args) (*Loader, error) { } // Create a watchdog. - dog := watchdog.New(k, watchdog.DefaultTimeout, args.Conf.WatchdogAction) + dogOpts := watchdog.DefaultOpts + dogOpts.TaskTimeoutAction = args.Conf.WatchdogAction + dog := watchdog.New(k, dogOpts) procArgs, err := newProcess(args.ID, args.Spec, creds, k, k.RootPIDNamespace()) if err != nil { |