Skip to content

Commit

Permalink
Fix watchForLockfileContention memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed May 7, 2021
1 parent 47e2caa commit 5149a75
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/kubelet/app/server_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func watchForLockfileContention(path string, done chan struct{}) error {
}
if err = watcher.AddWatch(path, inotify.InOpen|inotify.InDeleteSelf); err != nil {
klog.Errorf("unable to watch lockfile: %v", err)
watcher.Close()
return err
}
go func() {
Expand All @@ -39,6 +40,7 @@ func watchForLockfileContention(path string, done chan struct{}) error {
klog.Errorf("inotify watcher error: %v", err)
}
close(done)
watcher.Close()
}()
return nil
}

0 comments on commit 5149a75

Please sign in to comment.