microsoft / hcsshim

Windows - Host Compute Service Shim
MIT License
564 stars 253 forks source link

[release/0.11]: Fix process handle leak when launching a job container #2187

Closed yyatmsft closed 2 months ago

yyatmsft commented 2 months ago

Cherry-picking this PR into release/0.11

https://github.com/microsoft/hcsshim/pull/2020

commit: 976716ed6294e3a641d80196dcb08ac5eefd4091

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.

kiashok commented 2 months ago

nit: could you fix the title with "[release/0.11]" instead of "cherry-pick" ? Also would be good to have the commit hash of the original PR that you are using to cherry-pick in the PR description

kiashok commented 2 months ago

https://github.com/microsoft/hcsshim/pull/2020/files

kiashok commented 2 months ago

image

unrelated test failure