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

imp: exec: wait for job cgroup to be empty before exiting #187

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

grondo
Copy link
Contributor

@grondo grondo commented Nov 1, 2024

This PR modifies imp exec to wait for an "empty" cgroup before exiting, where empty means cgroup.procs contains only the IMP's own PID.

Problem: The SA_RESTART flag is used when establishing signal handlers
in the IMP, but this is not necessary (affected system calls like
waitpid(2) already check for EINTR). It may also be convenient in
future code to allow blocking system calls to be interrupted by
signals to force the recheck of a condition, such as checking the
contents of cgroup.procs.

Drop the use of the SA_RESTART flag.
Problem: The IMP immediately exits after waitpid(2) returns for its
immediate child, but this could leave extra processes running in the
job's cgroup.

Wait for the job cgroup to be empty before allowing the IMP to exit.

An empty cgroup is considered one in which the only process is
cgroup.procs is the IMP itself.
Problem: No test ensures that imp exec waits for the job cgroup to
be empty before exiting.

Add a test that sends SIGTERM to an IMP managing a process tree.
This kills the immediate child of the IMP, and the IMP must wait
until SIGUSR1 is sent, which terminates the cgroup with SIGKILL.
Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

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

LGTM! Seems straightforward.

@grondo
Copy link
Contributor Author

grondo commented Nov 1, 2024

Thanks I'll set MWP

@mergify mergify bot merged commit 198711d into flux-framework:master Nov 1, 2024
17 checks passed
@grondo grondo deleted the cgroup-wait branch November 1, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants