mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #100326 from wzshiming/fix/memory-leak
Fix watchForLockfileContention memory leak
This commit is contained in:
commit
10b09e8a46
@ -29,6 +29,7 @@ func watchForLockfileContention(path string, done chan struct{}) error {
|
|||||||
}
|
}
|
||||||
if err = watcher.AddWatch(path, inotify.InOpen|inotify.InDeleteSelf); err != nil {
|
if err = watcher.AddWatch(path, inotify.InOpen|inotify.InDeleteSelf); err != nil {
|
||||||
klog.ErrorS(err, "Unable to watch lockfile")
|
klog.ErrorS(err, "Unable to watch lockfile")
|
||||||
|
watcher.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
@ -39,6 +40,7 @@ func watchForLockfileContention(path string, done chan struct{}) error {
|
|||||||
klog.ErrorS(err, "inotify watcher error")
|
klog.ErrorS(err, "inotify watcher error")
|
||||||
}
|
}
|
||||||
close(done)
|
close(done)
|
||||||
|
watcher.Close()
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user