2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-22 10:22:18 +00:00
Files
xcat-core/build-utils/lib
Daniel Hilst 783c46bbf1 fix(xcat-core): a lock directory left by a killed build fails every later build of that target
SIGKILL and the OOM-killer run no handler, so a build killed that way leaves its
lock directory behind. Every later build of the same target then fails at mkdir
until an operator removes the directory by hand.
/var/lock/buildrpms.openeuler-20.03sp4-x86_64.lock.d on one build host was
created on 2026-10-14, held no owner file and no live process, and still failed
that target's dep build on 2026-10-21, one second into the genesis step. Every
other openEuler job in that run reported NOT_BUILT.

buildrpms.pl held its own lock, a bare mkdir that recorded no owner, and `use
autodie` wrapped that mkdir, so the EEXIST branch below it was dead code and the
run died on autodie's raw "Can't mkdir(...): File exists". That is why it never
refused anything and never named the build holding the lock.
XCAT::BuildUtils::take_build_lock kept a second hand-rolled lock with the same
gap.

Both now take the lock through XCAT::NFSLock, whose protocol recovers a lock
whose owner is provably dead. The lock stays in /var/lock, which is local,
because what it guards is host-local -- /etc/mock/<cfg>.cfg, /var/lib/mock/<cfg>/
and its buildroot.lock -- so a lock on the shared checkout would serialise the
per-arch builds of one checkout that run on two hosts and share nothing.

Depends on the matching xcat-dep change: that copy of NFSLock carries the
recovery of a borrow whose taker died, and a DESTROY, without which a guard
never releases at scope exit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 07:25:44 -03:00
..