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

Fix process handle leak when launching a job container #2020

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

kevpar
Copy link
Member

@kevpar kevpar commented Feb 7, 2024

CreateProcess gives us back a handle to the newly created process. Previously, we ignored this handle, which meant it was leaking every time we created a new job container (or anything else that uses internal/exec in the future).

Process handle leaks can be bad as an exited process is left as a "zombie" until all handles to it have closed, continuing to use memory.

Fix this by closing the handle from CreateProcess.

@kevpar kevpar requested a review from a team as a code owner February 7, 2024 16:11
@kevpar kevpar force-pushed the jc-leak branch 2 times, most recently from cd17da8 to 01b53e3 Compare February 7, 2024 16:22
internal/exec/exec.go Outdated Show resolved Hide resolved
CreateProcess gives us back a handle to the newly created process.
Previously, we ignored this handle, which meant it was leaking every
time we created a new job container (or anything else that uses
internal/exec in the future).

Process handle leaks can be bad as an exited process is left as a
"zombie" until all handles to it have closed, continuing to use memory.

Fix this by closing the handle from CreateProcess.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
@kevpar kevpar merged commit 9aabef8 into microsoft:main Feb 8, 2024
18 of 19 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.

None yet

3 participants