mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-09-09 22:46:44 +00:00
fix(xcat-dep): clear the build process group when its leader dies
run_bounded signalled the process group on a timeout and on a cancellation, but not when the leader itself died. A SIGKILL, or the OOM killer, takes the shell and leaves schroot and qemu in the group, holding the chroot and writing into staging after the call reports the build finished. Those processes are not children of this one, so there is nothing to wait for. Signal the group on the way out.
This commit is contained in:
@@ -333,7 +333,15 @@ sub run_bounded {
|
||||
return { ec => 124, timed_out => 1, elapsed => time - $t0 };
|
||||
}
|
||||
|
||||
return { ec => exit_status($status), timed_out => 0, elapsed => time - $t0 };
|
||||
my $ec = exit_status($status);
|
||||
# The leader can die without its descendants. A SIGKILL, or the OOM killer, takes the shell but
|
||||
# leaves schroot and qemu in its process group, still holding the chroot and writing into
|
||||
# staging after this call reports the build finished. They are not children of this process, so
|
||||
# there is nothing to wait for: signal the group and move on.
|
||||
kill('TERM', -$pid);
|
||||
Time::HiRes::sleep(0.2);
|
||||
kill('KILL', -$pid);
|
||||
return { ec => $ec, timed_out => 0, elapsed => time - $t0 };
|
||||
}
|
||||
|
||||
sub display_quote {
|
||||
|
||||
Reference in New Issue
Block a user