Fix file descriptor leaks of netns handles and sockets in netlink metrics collector.#522
Fix file descriptor leaks of netns handles and sockets in netlink metrics collector.#522MrHohn wants to merge 1 commit into
Conversation
…rics collector. - Add defer basens.Close() in getSnapshots to release base network namespace file descriptor. - Defer a single cleanup function at the beginning of getSnapshots to close all open namespace handles in the namespaces slice on function exit. - Explicitly close the netlink socket `s` on every return path inside getSnapshots loop, and at the end of the iteration, removing the unsafe defer-inside-loop pattern. - Close `ns` handle in getNamespaces when unix.Fstat fails.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MrHohn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/assign @MaitreyPrajapati |
|
@MrHohn: GitHub didn't allow me to assign the following users: MaitreyPrajapati. Note that only GoogleCloudPlatform members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
son every return path inside getSnapshots loop, and at the end of the iteration, removing the unsafe defer-inside-loop pattern.nshandle in getNamespaces when unix.Fstat fails.