From 17b84cfd3a37d9d5044d38061bd08d52a7e147bb Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Fri, 6 Nov 2026 16:24:46 -0300 Subject: [PATCH] fix(xcat-core): a worker that dies before release ends the build with SIGPIPE start_build_worker writes one byte to the gate pipe to release a worker after the build lock records its group. When the worker dies between the record and that write, the pipe has no reader and the write raises SIGPIPE. The default disposition ends the builder at once, so its cleanup never runs: the Debian package tree is not restored and the lock is not released. Ignore SIGPIPE for that one write. The write then fails with EPIPE and start_build_worker reports the worker as not released, which is the existing failure path. build_worker_gate_sigpipe.t passes with this change. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- build-utils/lib/XCAT/BuildUtils.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build-utils/lib/XCAT/BuildUtils.pm b/build-utils/lib/XCAT/BuildUtils.pm index a6a5cd8f1a..38aac57e93 100644 --- a/build-utils/lib/XCAT/BuildUtils.pm +++ b/build-utils/lib/XCAT/BuildUtils.pm @@ -797,7 +797,12 @@ sub start_build_worker { # lock forever, and the gated child has not run, so record nothing. my $ok = (POSIX::setpgid($pid, $pid) || $!{EACCES}) ? 1 : 0; $ok = attach_build_workers($pid) if $ok; - $ok = 0 if $ok && (syswrite($gate_w, 'g') // 0) != 1; + if ($ok) { + # A worker that died after the record leaves no reader. SIGPIPE would end the builder + # and skip its cleanup, so let the write fail with EPIPE instead. + local $SIG{PIPE} = 'IGNORE'; + $ok = 0 if (syswrite($gate_w, 'g') // 0) != 1; + } close($gate_w); # Scalar context gives the pid, so `start_build_worker(...) and next` keeps the meaning of # `$pm->start and next` whether or not the record succeeded.