From 11b0e08ab2fbd98c1b6b919434ea3ca5e2bb0c67 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Fri, 30 Oct 2026 10:02:19 -0300 Subject: [PATCH] fix(xcat-core): a build lock records process group 1 and refuses every later build xcat_pr_test fails in release_repository.t with "retained for surviving build workers in process group 1". The schedule stub in that test returns 1 from Parallel::ForkManager::start. start_build_worker() accepted ESRCH from setpgid() and recorded group 1 on the build lock. Group 1 is always alive, so the next buildrpms.pl run in the same lock directory is refused. ESRCH means the pid is not a child of this process. The gated child, if there is one, has not run, so start_build_worker() now records nothing and reports failure. It also no longer writes to a gate that no child reads. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- build-utils/lib/XCAT/BuildUtils.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build-utils/lib/XCAT/BuildUtils.pm b/build-utils/lib/XCAT/BuildUtils.pm index f2f65d2171..a6a5cd8f1a 100644 --- a/build-utils/lib/XCAT/BuildUtils.pm +++ b/build-utils/lib/XCAT/BuildUtils.pm @@ -793,8 +793,9 @@ sub start_build_worker { } close($gate_r); # Both sides set the group, so the record never names a pid that is not yet a group leader. - # ESRCH means the child has already gone away. - my $ok = (POSIX::setpgid($pid, $pid) || $!{EACCES} || $!{ESRCH}) ? 1 : 0; + # ESRCH means the pid is not a child of this process. A record of that group can keep the + # 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; close($gate_w);