From 835b6e9e1b4bfbc7a5926d915babad0d74516923 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Fri, 19 Jul 2019 01:07:49 -0700 Subject: [PATCH] sandbox: do not fail SIGKILL Once we have found the container, we should never fail SIGKILL. It is possible to fail to send SIGKILL because hypervisor might be gone already. If we fail SIGKILL, upper layer cannot really proceed to clean things up. Also there is no need to save sandbox here as we did not change any state. Signed-off-by: Peng Tao --- virtcontainers/sandbox.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/virtcontainers/sandbox.go b/virtcontainers/sandbox.go index fc60c6ab9..1356bfcc8 100644 --- a/virtcontainers/sandbox.go +++ b/virtcontainers/sandbox.go @@ -1180,14 +1180,15 @@ func (s *Sandbox) KillContainer(containerID string, signal syscall.Signal, all b } // Send a signal to the process. - if err := c.kill(signal, all); err != nil { - return err + err = c.kill(signal, all) + + // SIGKILL should never fail otherwise it is + // impossible to clean things up. + if signal == syscall.SIGKILL { + return nil } - if err = s.storeSandbox(); err != nil { - return err - } - return nil + return err } // DeleteContainer deletes a container from the sandbox