From f5d031ef7d3437a05fe41f80aaf0e59ac54a575b Mon Sep 17 00:00:00 2001 From: jiangpengfei9 Date: Mon, 1 Apr 2019 12:35:59 -0400 Subject: [PATCH 2/2] kata-shim: fix kata-shim process wait long time to exit problem reason: If containerd-shim process is killed and call kata-runtime delete -f command to delete container, it will wait 10s for kata-shim process exit in the waitForShim function, however 10s wait time is too long in the case of containerd-shim and containerd process is killed.So when containerd-shim process is killed, kata-shim process will receive a SIGHUP signal, we can handle this signal as exit signal which makes kata-shim process exit. Signed-off-by: jiangpengfei9 --- shim.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shim.go b/shim.go index a93a00d..90172fe 100644 --- a/shim.go +++ b/shim.go @@ -134,6 +134,12 @@ func (s *shim) handleSignals(ctx context.Context, tty *os.File) chan os.Signal { backtrace() } + // if containerd-shim process is killed, kata-shim will receive SIGHUP signal + if sysSig == syscall.SIGHUP { + logger().WithField("signal", sig).Warn("received SIGHUP signal") + os.Exit(1) + } + // forward this signal to container _, err := s.agent.SignalProcess(s.ctx, &pb.SignalProcessRequest{ ContainerId: s.containerID, -- 1.8.3.1