Commit eb65986
fix(ic-os): serialize podman's SHM lock creation to stop flaky exit-125 builds
ic-os container builds intermittently die with:
Error: failed to get new shm lock manager: failed to create 2048 locks in
/libpod_rootless_lock_1001: file exists
Podman keeps its container lock manager in a shared memory segment (one per
uid when rootless, a single unsuffixed one as root). It opens that segment if
it exists and otherwise creates it O_EXCL, with nothing serializing the gap
between those two steps. ic-os actions run concurrently and unsandboxed
(--strategy_regexp=ic-os[:/].*=local), so on a machine where the segment does
not exist yet -- a fresh CI container -- the first burst of actions all find
it missing and race to create it, and the losers exit 125.
That is why this only ever bites early in a job: measured here, 832
concurrent invocations with the segment already present produced 0 failures,
while deleting it and running 16 concurrently reproduced the error.
Materialize the segment exactly once under a lock of our own, before the
build starts. Once it exists podman only ever opens it, so every later action
pays a single `test -e` -- no lock, no extra podman, and the builds
themselves are never serialized. Also applied to build-bootloader-tree.sh,
which drives podman outside the wrapper and can be part of the same first
burst; two independent pre-warms would defeat each other.
Measured with 5 rounds of 16 concurrent invocations from a cold segment,
counting actions that reach podman while the segment is still absent (the
race-exposed state):
before after
rootless 80/80 0/80
root 80/80 0/80
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 0d845e0 commit eb65986
2 files changed
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
28 | 46 | | |
29 | 47 | | |
30 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
15 | 52 | | |
16 | 53 | | |
17 | 54 | | |
| |||
0 commit comments