From 67507bd579a305e5d993c7cca71b665f33f341ff Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Thu, 12 Jul 2018 13:36:01 -0700 Subject: 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 --- runsc/boot/loader.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'runsc/boot/loader.go') diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go index a3cc0e4a4..7de0a84cc 100644 --- a/runsc/boot/loader.go +++ b/runsc/boot/loader.go @@ -347,9 +347,12 @@ func newProcess(spec *specs.Spec, conf *Config, ioFDs []int, console bool, creds } // Destroy cleans up all resources used by the loader. +// +// Note that this will block until all open control server connections have +// been closed. For that reason, this should NOT be called in a defer, because +// a panic in a control server rpc would then hang forever. func (l *Loader) Destroy() { if l.ctrl != nil { - // Shut down control server. l.ctrl.srv.Stop() } l.stopSignalForwarding() -- cgit v1.2.3