neiam
/lambent-flex-c6
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
Ask the build for fewer processes than the runner will give
65e23ac · Gabriel Morell · 2026-09-16 18:34
Message
{commit_body(@commit)}
Files changed
modified
.forgejo/workflows/firmware.yml
+28
−0
@@ -110,6 +110,27 @@ jobs:
| 110 | 110 | set -euo pipefail |
| 111 | 111 | mkdir -p .home |
| 112 | 112 | |
| 113 | + # `bash: fork: retry: Resource temporarily unavailable` killed run | |
| 114 | + # #2 here. That is a process ceiling, not a build error: cargo and | |
| 115 | + # ninja both default to one job per core, and an ESP-IDF build plus | |
| 116 | + # a Rust codegen fan-out is hundreds of processes on a machine with | |
| 117 | + # many of them. Whatever the ceiling turns out to be — a pids cgroup, | |
| 118 | + # RLIMIT_NPROC, or memory — asking for less is the fix that does not | |
| 119 | + # depend on knowing which. | |
| 120 | + # | |
| 121 | + # Four is deliberately modest. This build is dominated by one cold | |
| 122 | + # ESP-IDF install and link, not by parallel compilation, so the cost | |
| 123 | + # is small and the failure it avoids is total. | |
| 124 | + cores=$(nproc) | |
| 125 | + jobs=$(( cores > 4 ? 4 : cores )) | |
| 126 | + echo "building with $jobs jobs (of $cores cores)" | |
| 127 | + | |
| 128 | + # Printed rather than interpreted: if this still dies, these four | |
| 129 | + # numbers say which ceiling it was, and reading them out of a log | |
| 130 | + # beats guessing at it a second time. | |
| 131 | + echo "host: nproc=$cores ulimit-u=$(ulimit -u) pids.max=$(cat /sys/fs/cgroup/pids.max 2>/dev/null || echo n/a)" | |
| 132 | + free -m 2>/dev/null | head -2 || true | |
| 133 | + | |
| 113 | 134 | # As root, then chown back: the workspace belongs to whatever user |
| 114 | 135 | # the runner runs as, the image's own user is `esp`, and the two |
| 115 | 136 | # need not agree. Root can write either way, and the chown at the |
@@ -131,6 +152,11 @@ jobs:
| 131 | 152 | -e LAMBENT_FLEX_VERSION="$VERSION" \ |
| 132 | 153 | -e HOST_UID="$(id -u)" \ |
| 133 | 154 | -e HOST_GID="$(id -g)" \ |
| 155 | + -e CARGO_BUILD_JOBS="$jobs" \ | |
| 156 | + -e NUM_JOBS="$jobs" \ | |
| 157 | + -e CMAKE_BUILD_PARALLEL_LEVEL="$jobs" \ | |
| 158 | + -e MAKEFLAGS="-j$jobs" \ | |
| 159 | + --pids-limit 8192 \ | |
| 134 | 160 | "$TOOLCHAIN_IMAGE" \ |
| 135 | 161 | bash -euo pipefail -c ' |
| 136 | 162 | # ESP-IDF builds with cmake and the image ships ninja but not |
@@ -142,6 +168,8 @@ jobs:
| 142 | 168 | apt-get install -y --no-install-recommends cmake >/dev/null |
| 143 | 169 | fi |
| 144 | 170 | |
| 171 | + echo "container: ulimit-u=$(ulimit -u) pids.max=$(cat /sys/fs/cgroup/pids.max 2>/dev/null || echo n/a) jobs=$CARGO_BUILD_JOBS" | |
| 172 | + | |
| 145 | 173 | cargo build --release |
| 146 | 174 | |
| 147 | 175 | mkdir -p dist |
Parents: e6c7b44