diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2018-07-12 13:36:01 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-07-12 13:36:57 -0700 |
commit | 67507bd579a305e5d993c7cca71b665f33f341ff (patch) | |
tree | 7dd1a20dcefb11cdb19afcff44afc4538ffa8ce9 /runsc/cmd | |
parent | 41e0b977e5ffc667750c0f706bb70173c5de2161 (diff) |
runsc: Don't close the control server in a defer.
Closing the control server will block until all open requests have completed.
If a control server method panics, we end up stuck because the defer'd Destroy
function will never return.
PiperOrigin-RevId: 204354676
Change-Id: I6bb1d84b31242d7c3f20d5334b1c966bd6a61dbf
Diffstat (limited to 'runsc/cmd')
-rw-r--r-- | runsc/cmd/boot.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/runsc/cmd/boot.go b/runsc/cmd/boot.go index b19da315f..70c4616b4 100644 --- a/runsc/cmd/boot.go +++ b/runsc/cmd/boot.go @@ -142,24 +142,23 @@ func (b *Boot) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) } // Create the loader. - l, err := boot.New(spec, conf, b.controllerFD, b.restoreFD, b.ioFDs.GetArray(), b.console) - if err != nil { Fatalf("error creating loader: %v", err) } - defer l.Destroy() // Wait for the start signal from runsc. l.WaitForStartSignal() // Run the application and wait for it to finish. if err := l.Run(); err != nil { + l.Destroy() Fatalf("error running sandbox: %v", err) } ws := l.WaitExit() log.Infof("application exiting with %+v", ws) *waitStatus = syscall.WaitStatus(ws.Status()) + l.Destroy() return subcommands.ExitSuccess } |