Repository navigation
fix(ci): add swap to StartWRT riscv64 builds - #4803
Conversation
Since 2026-11-16 the riscv64 build has been SIGKILLed while compiling start-core, on master and on unrelated PRs. Every kill ran on an AWS-hosted ubuntu-latest runner: 15.33 GiB of RAM and no swap, since the runner image only creates its 4 GiB swapfile through the Azure agent. Azure runners (15.61 GiB + 4 GiB swap) have not failed. The build peaks at about 13.2 GB of anonymous memory while start-core is still generating code and startwrt-core has already started. On an AWS runner that leaves little or no headroom. setup-build gains a swap-size input. start-wrt.yaml passes 8G to both jobs that compile the binary, including the OpenWrt image job, whose start-wrt-image target rebuilds it.
There was a problem hiding this comment.
Approved. No correctness findings in a3a0a0547; it merges cleanly into current master.
Both StartWRT jobs that compile the riscv64 binary now request an additional 8 GiB of swap through the existing shared setup action. This includes the OpenWrt image job's binary-staging dependency. Existing swap is retained, and callers that omit the input remain unchanged. The input reaches the shell through a quoted environment variable, and swap-setup failures fail the job.
The tradeoff is 8 GiB of runner disk per opted-in job, including runners that already have swap, to absorb transient compiler memory peaks without reducing compilation parallelism. The size is chosen headroom, not a measured minimum; the forced-pressure experiment used about 1.5 GB of swap.
This is not evidence of a RISC-V-specific memory requirement. StartWRT's shipping build only targets riscv64, so there is no equivalent x86/ARM StartWRT comparison here. It imports the full start-core crate, including OS-only modules, then compiles a substantial router crate alongside start-core's unfinished code generation. The author measured compiler-process peaks of 11.1 GB and 3.5 GB respectively, with a combined anonymous-memory peak of 13.2 GB. The other product crates are thin wrappers, so they do not add the same second large compilation. Earlier separate profiling found roughly 21 million LLVM IR lines for start-core and substantial RPC-toolkit generic specialization; that establishes a large compiler workload, not a per-allocation explanation of this PR's memory peak. Swap mitigates that footprint without reducing it. A matched cross-target compiler profile would be needed to attribute any excess specifically to the RISC-V backend.
Implementation diff: +19 / −0 lines in 2 files (excludes lockfiles, tests, docs, release notes, and changelog).
Verification: the author reports reproducing the SIGKILL with a 12 GiB memory cap and no swap, completing with that cap plus 8 GiB swap, and successfully exercising swap on an AWS-like ext4/device-mapper storage stack. Reported Prettier, actionlint, shellcheck, and workflow-retarget checks pass. I reviewed the code and build callers without running builds or tests. All current non-skipped CI checks now pass, including the riscv64 build, product builds, builder verification, automated checks, and StartOS image matrix. The full OpenWrt image job is gated off on this PR.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
|
An alternative raised in discussion with @dr-bonez: build This would remove the overlap between the two large compiler processes while retaining normal dependency parallelism within each stage, unlike a global The important constraint is artifact reuse: both invocations must use the same K1 target, profile, compiler flags, and unified dependency features. A standalone This is an alternative to measure, not a demonstrated replacement yet. The useful comparison is peak memory and elapsed time without swap, with confirmation that the second stage reuses rather than recompiles |
|
I checked the two-stage proposal against The two stages build different
Each difference changes that dependency's metadata hash, and with it Sharing configuration can't close the gap. Headroom. Removing the overlap saves about 2 GB in the local measurement: 13.2 GB combined drops to the 11.1 GB of Build time. On 4 cores, Once the two feature graphs agree, staging could be added alongside swap, but it doesn't replace it. This PR's swap remains the fix for the AWS kills. |
helix-white
left a comment
There was a problem hiding this comment.
Approved on re-review. The head remains a3a0a0547, unchanged from my previous review, and merges cleanly into current master.
Both StartWRT jobs that compile the riscv64 binary add 8 GiB of swap through the shared setup action. Existing swap is retained; other callers keep the empty default and remain unchanged. Setup errors fail the job. This adds runner capacity for overlapping compilation of the large start-core and router crates rather than reducing their compiler footprint. The disk cost is 8 GiB per opted-in job, including runners that already have swap; that size is chosen headroom, not a measured minimum.
The two-stage alternative raised with @dr-bonez is not a drop-in replacement. The author reports that a standalone start-core selection and the StartWRT selection resolve eight shared dependencies with different features, including transitive dependencies. Matching compiler flags alone therefore would not provide reusable artifacts: the second invocation would rebuild start-core. I do not request a manually duplicated feature list or a change to other products' feature selection to make staging work. A correctly matched staged build remains possible in principle, but neither its memory sufficiency without swap nor its elapsed-time cost has been measured; the feature-graph result does not establish that such a build could never replace swap.
Implementation diff: +19 / −0 lines in 2 files (excludes lockfiles, tests, docs, release notes, and changelog).
Verification evidence: all current non-skipped CI checks pass, including the StartWRT binary, builder verification, automated checks, product builds, and StartOS image matrix. The author also reports that a 12 GiB memory cap without swap reproduces the SIGKILL, while that cap plus 8 GiB swap completes using about 1.5 GB of swap, and that the swap commands work on an AWS-like storage stack. The full OpenWrt image job is gated off on this PR. I reviewed code and recorded evidence without running builds or tests.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
|
Thanks for checking the dependency graphs. That makes the artifact-reuse caveat concrete: sharing target/profile/compiler flags is insufficient, and the naïve two-command prebuild would compile One distinction: this rules out that naïve implementation, not a correctly matched staged build in principle. Whether the latter could avoid AWS OOMs without swap, and its build-time cost, remain unmeasured. I have re-approved the unchanged head and included this assessment in the approval brief. I am not requesting staging as a condition of this swap fix; it remains an optimization to evaluate separately if pursued. |
StartWRT's riscv64 builds add an 8 GiB swapfile. Since 2026-11-16,
Build riscv64 binaryhas failed intermittently on master and unrelated PRs: rustc is SIGKILLed while compilingstart-core(could not compile start-core … signal: 9).Cause
All four kills ran on AWS-hosted
ubuntu-latestrunners. These runners have 15.33 GiB of RAM and no swap. The Azure-hosted ones have 15.61 GiB plus a 4 GiB swapfile./dev/mapper/cow-root,7.0.0-1016-aws/dev/root,7.0.0-1019-azureThe fourth kill, on 2026-11-16, predates this sample and also ran on AWS.
The runner image only creates its 4 GiB swapfile through the Azure agent's config (
ResourceDisk.SwapSizeMB=4096inimages/ubuntu/scripts/build/configure-environment.sh).actions/runner-images#15335made that conditional on the agent being present, and AWS VMs don't have it.The build peaks during a window of about five minutes.
start-coreis still generating code, andstartwrt-corestarts compiling as soon asstart-core's metadata is ready.start-core's source grew 21% on 2026-11-13 (#4583, #4485), which moved that peak close to an AWS runner's limit.Change
setup-buildtakes aswap-sizeinput. When set, it adds and enables a swapfile of that size. It is empty by default, so no other caller changes.start-wrt.yamlsetsBUILD_SWAP_SIZE: 8Gonce and passes it to both jobs that compile the riscv64 binary:Build riscv64 binaryandBuild OpenWrt image(start-wrt-imagerebuilds the binary throughfiles/.staged).start-coreto keep growing. Both runner types start the job with 88–91 GB of disk free.start-corethat is idle during that window.start-corefrees it a few minutes later, so swapped pages are mostly discarded rather than read back.StartOS's riscv64 compile runs on the same runner class, but no large crate compiles alongside its
start-core, and it has had no kills. It can use the same input if that changes.Because
setup-buildis an input to the StartOS image builds, this PR also builds the StartOS image matrix.Verification
Build measurements ran on master
926e4aa82with CI's builder image (ghcr.io/start9labs/cargo-zigbuild@sha256:50a56623…), restricted to 4 CPUs (--cpuset-cpus=0-3) as on the runner. Memory was sampled every 2 s from the container's cgroup.start-core's rustc reached 11.1 GB, andstartwrt-corereached 3.5 GB alongside it.start-coreandstartwrt-core:start-coreSIGKILLed, the same failure as CIThe 12 GiB cap was chosen below the measured peak to force an overflow. It shows that swap absorbs one without slowing the build. It does not measure how far short an AWS runner falls.
/as ext4 on a device-mapper snapshot over NVMe, withdiscard,journal_async_commit,nobarrier,data=writeback,commit=30. I replicated that: ext4 with those options on a non-persistentdm-snapshotover direct-I/O loop devices.fallocate,mkswap,swapon) activated the swapfile.start-wrt.yaml, shellcheck on the step's script, andcheck-pr-retarget-workflows.pypass ona3a0a0547, which is based on926e4aa82.This PR's own CI will land on AWS or Azure at random. On an AWS runner,
swapon --showin theAdd swapstep lists/swapfile-buildas the only swap.