diff options
Diffstat (limited to 'runsc/boot/loader.go')
-rw-r--r-- | runsc/boot/loader.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go index 8d71d7447..d8282d1d1 100644 --- a/runsc/boot/loader.go +++ b/runsc/boot/loader.go @@ -16,6 +16,7 @@ package boot import ( + gcontext "context" "errors" "fmt" mrand "math/rand" @@ -468,6 +469,8 @@ func createProcessArgs(id string, spec *specs.Spec, creds *auth.Credentials, k * return procArgs, nil } +const destroyTimeout = 15 * gtime.Second + // Destroy cleans up all resources used by the loader. // // Note that this will block until all open control server connections have @@ -482,7 +485,9 @@ func (l *Loader) Destroy() { // Stop the control server. This will indirectly stop any // long-running control operations that are in flight, e.g. // profiling operations. - l.ctrl.stop() + ctx, cancel := gcontext.WithTimeout(context.Background(), destroyTimeout) + defer cancel() + l.ctrl.stop(ctx) // Release all kernel resources. This is only safe after we can no longer // save/restore. |