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 <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao 2019-07-19 01:07:49 -07:00
parent bc4460e12f
commit 835b6e9e1b

View File

@ -1180,14 +1180,15 @@ func (s *Sandbox) KillContainer(containerID string, signal syscall.Signal, all b
} }
// Send a signal to the process. // Send a signal to the process.
if err := c.kill(signal, all); err != nil { err = c.kill(signal, all)
return err
// 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 err
}
return nil
} }
// DeleteContainer deletes a container from the sandbox // DeleteContainer deletes a container from the sandbox