Skip to content

fix(core): close netns and netlink handles in ListContainerInterfaces#3161

Merged
hellt merged 1 commit intosrl-labs:mainfrom
Aprazor:fix/list-netns-handle-leak
Apr 14, 2026
Merged

fix(core): close netns and netlink handles in ListContainerInterfaces#3161
hellt merged 1 commit intosrl-labs:mainfrom
Aprazor:fix/list-netns-handle-leak

Conversation

@Aprazor
Copy link
Copy Markdown
Contributor

@Aprazor Aprazor commented Apr 12, 2026

netns.NsHandle wraps a file descriptor and netlink.Handle holds netlink sockets. Neither was closed after use in ListContainerInterfaces, leaking resources on every call to clab inspect interfaces.

Added defer .Close() for both handles, matching the pattern used in core/events/netlink.go.

Testing

  • go vet ./core/... — clean
  • go test -race ./core/... — all pass

netns.NsHandle wraps a file descriptor and netlink.Handle holds
netlink sockets. Neither was closed after use, leaking resources on
every call to inspect interfaces. With large labs this accumulates
leaked file descriptors.
@hellt hellt merged commit 09c5d9a into srl-labs:main Apr 14, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants