fix(kill): close netns FD to prevent leak and lock OS thread#495
fix(kill): close netns FD to prevent leak and lock OS thread#495AyushSriv06 wants to merge 1 commit intourunc-dev:mainfrom
Conversation
Signed-off-by: Ayush <ayushsrisks@gmail.com>
✅ Deploy Preview for urunc canceled.
|
|
Hello @AyushSriv06 , thank you for this PR. Please open an issue first, if you find something. We need to verify it first and then open a PR. FOr example in this PR the locking of the thread takes place earlier here Line 48 in d7814ce Line 50 in d7814ce |
okay, it was a confusion from my side, should i open a issue for the fd leak? |
|
Regarding the netns fd, I can not see how this can lead to a leak. The kernel cleans up all the resources after the process exits and the kill path in However, for sanity we can close the file descriptor right after we enter the namespace. No need for a defer. |
Description
Adds a missing close call to prevent leaking file descriptors when joining network namespaces.
Enforces thread locking in Kill() to ensure network operations execute safely on the correct OS thread.
Related issues
N/A
How was this tested?
buid and lint
LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).