2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-07-31 10:09:40 +00:00

fix(xcat-core): treat signal-killed build workers as failures too

The parallel-build failure gate only inspected $exit_code in run_on_finish. A
ForkManager child killed by a signal -- SIGKILL, or the OOM-killer under the
concurrent build load -- is reaped with $exit_code == 0 but $exit_signal != 0
(and possibly $core_dump). Such a worker therefore was NOT recorded as a
failure, so the parent could still index and GPG-sign a repository that is
missing the package that worker was building -- the exact partial-repo hazard
the gate was added to prevent, via a path it did not cover.

Capture $exit_signal and $core_dump from the run_on_finish callback and fail
the build when any of $exit_code, $exit_signal, or $core_dump is set.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-07-30 19:03:00 -03:00
parent 0c26dc19f5
commit d621d7fc29
+6 -4
View File
@@ -999,11 +999,13 @@ sub main {
local $SIG{TERM} = \&abort_builds;
$pm->run_on_start(sub { my ($pid, $chroot) = @_; $MOCK_INFLIGHT{$pid} = $chroot if defined $chroot; });
$pm->run_on_finish(sub {
my ($pid, $exit_code, $ident) = @_;
my ($pid, $exit_code, $ident, $exit_signal, $core_dump) = @_;
delete $MOCK_INFLIGHT{$pid};
# A build/update child that die()s (e.g. a failed sh_retry) exits non-zero; record it so
# we never index or sign a partial repository (would ship a core missing packages).
push @CHILD_FAILURES, ($ident // "pid=$pid") if $exit_code;
# A child that die()s exits non-zero; one killed by a SIGNAL (SIGKILL / OOM-killer) is reaped
# with $exit_code==0 but $exit_signal!=0 (and maybe $core_dump). Checking $exit_code alone
# would let an OOM-killed worker through and the parent would index+sign a partial repository
# (a core missing packages). Treat a non-zero exit, a killing signal, OR a core dump as failure.
push @CHILD_FAILURES, ($ident // "pid=$pid") if $exit_code || $exit_signal || $core_dump;
});
for my $pair (@rpms) {