From 749399ec337841b284306354b557b594707571b8 Mon Sep 17 00:00:00 2001 From: Peter Morjan Date: Wed, 8 Feb 2017 10:14:03 +0100 Subject: [PATCH] add Wait() for nslistener process to avoid zombies This patch adds a missing cmd.Wait() to wait for process completion of containerd-nslistener. Without the wait every container leaves a defunct process. This is required since #430 removed the global SIGCHILD handler to avoid runtime panics. Signed-off-by: Peter Morjan --- supervisor/hyperpod.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/supervisor/hyperpod.go b/supervisor/hyperpod.go index 90a4ad86..cde9afc7 100644 --- a/supervisor/hyperpod.go +++ b/supervisor/hyperpod.go @@ -366,7 +366,12 @@ func (hp *HyperPod) startNsListener() (err error) { func (hp *HyperPod) stopNsListener() { if hp.nslistener != nil { - hp.nslistener.cmd.Process.Kill() + hp.nslistener.cmd.Process.Signal(syscall.SIGTERM) + timer := time.AfterFunc(time.Second*1, func() { + hp.nslistener.cmd.Process.Kill() + }) + hp.nslistener.cmd.Wait() + timer.Stop() } }