From 4ba5ca319b8a364cd47ba715982969c78eeb757a Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 19 Jul 2021 19:43:32 +0300 Subject: [PATCH] Call process.Wait to reap children --- pkg/mounter/mounter.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/mounter/mounter.go b/pkg/mounter/mounter.go index a7e3eb3..11a4f84 100644 --- a/pkg/mounter/mounter.go +++ b/pkg/mounter/mounter.go @@ -134,22 +134,23 @@ func waitForProcess(p *os.Process, limit int) error { cmdLine, err := getCmdLine(p.Pid) if err != nil { glog.Warningf("Error checking cmdline of PID %v, assuming it is dead: %s", p.Pid, err) + p.Wait() return nil } if cmdLine == "" { - // ignore defunct processes - // TODO: debug why this happens in the first place - // seems to only happen on k8s, not on local docker glog.Warning("Fuse process seems dead, returning") + p.Wait() return nil } if err := p.Signal(syscall.Signal(0)); err != nil { glog.Warningf("Fuse process does not seem active or we are unprivileged: %s", err) + p.Wait() return nil } glog.Infof("Fuse process with PID %v still active, waiting...", p.Pid) time.Sleep(time.Duration(math.Pow(1.5, float64(backoff))*100) * time.Millisecond) } + p.Release() return fmt.Errorf("Timeout waiting for PID %v to end", p.Pid) }