Skip to content

Commit

Permalink
Merge pull request kubernetes#106383 from rphillips/automated-cherry-…
Browse files Browse the repository at this point in the history
…pick-of-#106382-upstream-release-1.22

Automated cherry pick of kubernetes#106382: defer close the rotated log open
  • Loading branch information
k8s-ci-robot committed Nov 12, 2021
2 parents bfdfba3 + b54f9d7 commit 2456f3f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/kubelet/kuberuntime/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ func ReadLogs(ctx context.Context, path, containerID string, opts *LogOptions, r
}
return fmt.Errorf("failed to open log file %q: %v", path, err)
}
defer newF.Close()
f.Close()
if err := watcher.Remove(f.Name()); err != nil && !os.IsNotExist(err) {
klog.ErrorS(err, "Failed to remove file watch", "path", f.Name())
Expand Down

0 comments on commit 2456f3f

Please sign in to comment.