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

Cgroup2: Cleanup procs in TestKill #286

Merged
merged 1 commit into from
Apr 26, 2023
Merged

Conversation

dcantah
Copy link
Member

@dcantah dcantah commented Apr 11, 2023

If the test fails before we get to calling manager.Kill we'll leak the 5 sleep processes, and its harmless to call this
at the end of the test also. This additionally removes the cmd.Process nil check as the comment in the stdlib states that
cmd.Process will be filled in if Start returns successfully.

@manugupt1
Copy link
Contributor

Just a small comment: Should we kill all managers on cleanup using manager.Kill?

@dcantah
Copy link
Member Author

dcantah commented Apr 19, 2023

@manugupt1 I did a Kill on anything that actually launched any processes, I'd say it's case by case BUT we could add a test helper in a follow up here to check the number of processes running -> Call Kill if there is any -> Always call delete

@manugupt1
Copy link
Contributor

Oh okay! I was just wondering.

@dcantah
Copy link
Member Author

dcantah commented Apr 19, 2023

I think it's a good idea! It's easy to forget to cleanup so if future authors see we always just call 'CleanupCgroup' or something similar the situation would be better I think

cgroup2/manager_test.go Outdated Show resolved Hide resolved
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dcantah
Copy link
Member Author

dcantah commented Apr 20, 2023

@manugupt1 Oh woops, I just realized your comment for calling manager.Kill was on this PR and not #282. So the rationale here is if the process failed to join the cg we'd leak it. There's another test that adds a process to a cg here, TestMoveTo, which adds the current process to the CG.. which is annoying as we can't call Kill on the cg then, so I've changed that test to launch sleep infinity as well. I'll add the same Pdeathsig option on that PR.

If the test fails before we get to calling manager.Kill
we'll leak the 5 sleep processes.

Signed-off-by: Danny Canter <danny@dcantah.dev>
@dcantah
Copy link
Member Author

dcantah commented Apr 25, 2023

Resolved merge conflicts from 55c197e

@estesp estesp merged commit 0c6b78b into containerd:main Apr 26, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants