Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cilium-dbg: avoid leaking file resources #31750

Merged
merged 2 commits into from Apr 3, 2024

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Apr 3, 2024

Files opened using os.Open{,File} need to be closed manually using os.(*File).Close to avoid leaking os.(*File) instances and file descriptors.

If os.OpenFile returns an error we shouldn't be writing to the returned
os.(*File) instance which might be nil.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
Files opened using os.Open{,File} need to be closed manually using
os.(*File).Close to avoid leaking os.(*File) instances and file
descriptors.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser added release-note/misc This PR makes changes that have no direct user impact. needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch labels Apr 3, 2024
@tklauser tklauser requested a review from a team as a code owner April 3, 2024 13:25
@tklauser tklauser requested a review from derailed April 3, 2024 13:25
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.13.15 Apr 3, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.14.10 Apr 3, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.15.4 Apr 3, 2024
@tklauser
Copy link
Member Author

tklauser commented Apr 3, 2024

/test

Copy link
Contributor

@derailed derailed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tklauser Nice catch. Thanks for the updates Tobias!

@tklauser tklauser enabled auto-merge April 3, 2024 15:02
@tklauser tklauser added this pull request to the merge queue Apr 3, 2024
Merged via the queue into main with commit 7aa2c74 Apr 3, 2024
228 of 230 checks passed
@tklauser tklauser deleted the pr/tklauser/debuginfo-file-leak branch April 3, 2024 15:36
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Apr 3, 2024
@nbusseneau nbusseneau mentioned this pull request Apr 10, 2024
8 tasks
@nbusseneau nbusseneau added backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. and removed needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch labels Apr 10, 2024
@nbusseneau nbusseneau mentioned this pull request Apr 10, 2024
9 tasks
@nbusseneau nbusseneau added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Apr 10, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.13 in 1.13.15 Apr 10, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.14 in 1.14.10 Apr 10, 2024
@nbusseneau nbusseneau mentioned this pull request Apr 10, 2024
13 tasks
@nbusseneau nbusseneau added backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. and removed needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch labels Apr 10, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.15 in 1.15.4 Apr 10, 2024
@github-actions github-actions bot added backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. and removed backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. labels Apr 11, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed this from Backport pending to v1.15 in 1.15.4 Apr 11, 2024
@asauber asauber added this to Backport pending to v1.13 in 1.13.16 Apr 11, 2024
@asauber asauber removed this from Backport pending to v1.13 in 1.13.15 Apr 11, 2024
@github-actions github-actions bot added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Apr 11, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed this from Backport pending to v1.14 in 1.14.10 Apr 11, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Backport done to v1.14 in 1.14.10 Apr 11, 2024
@github-actions github-actions bot added backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. and removed backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. labels Apr 17, 2024
@nebril nebril moved this from Backport pending to v1.13 to Backport done to v1.13 in 1.13.16 May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.13.16
Backport done to v1.13
1.14.10
Backport done to v1.14
Development

Successfully merging this pull request may close these issues.

None yet

3 participants