diff --git a/pkg/s3/util.go b/pkg/s3/util.go index c1b37fe..87f1c96 100644 --- a/pkg/s3/util.go +++ b/pkg/s3/util.go @@ -17,6 +17,18 @@ func waitForProcess(p *os.Process, backoff int) error { if backoff == 20 { return fmt.Errorf("Timeout waiting for PID %v to end", p.Pid) } + cmdLine, err := getCmdLine(p.Pid) + if err != nil { + glog.Warningf("Error checking cmdline of PID %v, assuming it is dead: %s", p.Pid, err) + 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") + 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) return nil @@ -38,12 +50,6 @@ func findFuseMountProcess(path string, name string) (*os.Process, error) { glog.Errorf("Unable to get cmdline of PID %v: %s", p.Pid(), err) continue } - if cmdLine == "" { - // ignore defunct processes - // TODO: debug why this happens in the first place - // seems to only happen on k8s, not on local docker - continue - } if strings.Contains(cmdLine, path) { glog.Infof("Found matching pid %v on path %s", p.Pid(), path) return os.FindProcess(p.Pid())