From ac068a1f9de2b20b145b5682cd514c1f6b1fac17 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Fri, 22 Jul 2016 15:21:10 -0700 Subject: [PATCH] Fix missing unlock in libcontainerd.Restore() This was preventing the "exit" event to be correctly processed during the restore process without live-restore enabled. Signed-off-by: Kenfe-Mickael Laventure --- libcontainerd/client_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libcontainerd/client_linux.go b/libcontainerd/client_linux.go index 340793724a..d2d91f2596 100644 --- a/libcontainerd/client_linux.go +++ b/libcontainerd/client_linux.go @@ -544,6 +544,8 @@ func (clnt *client) Restore(containerID string, options ...CreateOption) error { if err := clnt.Signal(containerID, int(syscall.SIGTERM)); err != nil { logrus.Errorf("libcontainerd: error sending sigterm to %v: %v", containerID, err) } + // Let the main loop handle the exit event + clnt.remote.Unlock() select { case <-time.After(10 * time.Second): if err := clnt.Signal(containerID, int(syscall.SIGKILL)); err != nil { @@ -552,9 +554,13 @@ func (clnt *client) Restore(containerID string, options ...CreateOption) error { select { case <-time.After(2 * time.Second): case <-w.wait(): + // relock because of the defer + clnt.remote.Lock() return nil } case <-w.wait(): + // relock because of the defer + clnt.remote.Lock() return nil }