From 754567ec6c8347f1c397d8a574f22ad916a7c104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 6 Sep 2026 15:55:23 -0300 Subject: [PATCH] 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. --- lib/XCAT/BuildUtils.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/XCAT/BuildUtils.pm b/lib/XCAT/BuildUtils.pm index fc5172d..a464318 100644 --- a/lib/XCAT/BuildUtils.pm +++ b/lib/XCAT/BuildUtils.pm @@ -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 {