Files
gongfoo/images/runner-rust-ubuntu/Containerfile
rob thijssen fcb1f3b033 fix(images): set RUST_MIN_STACK to stop sccache-driven rustc SIGSEGV
The neuron CUDA builds SIGSEGV'd rustc in LLVM's SROA pass on candle-core
whenever sccache was the wrapper, but compiled fine without it. Root cause:
the workflow pre-starts the sccache server in a bare shell (`sccache
--start-server`), so per sccache's documented behaviour the orphaned server
creates its OWN jobserver with one slot per CPU core (24 on quadbrat),
ignoring Cargo's CARGO_BUILD_JOBS=8. rustc then runs up to 24-way parallel
LLVM codegen; on candle-core's huge cuda-feature functions the concurrent
SROA passes overflow the default 8 MiB codegen-thread stack and kill rustc
with SIGSEGV — the exact "set RUST_MIN_STACK" case rustc prints. Cargo's own
8-slot jobserver (the no-sccache path) stays within budget and compiles.

Set RUST_MIN_STACK=32 MiB in the standalone Rust images (runner-rust,
runner-cuda-13.0, runner-rust-ubuntu); the gtk3/ffmpeg/deb images inherit it.
It's rustc's own recommended mitigation, virtual-only until used, and protects
every repo regardless of how it drives sccache. Pair with raising the cuda
runner image's mem_request_mb so the parallel codegen has headroom.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 13:18:25 +03:00

29 lines
1.1 KiB
Docker

FROM git.lair.cafe/gongfoo/runner-ubuntu-24.04:latest
ARG SCCACHE_VERSION=0.15.0
ENV DEBIAN_FRONTEND=noninteractive
# Codegen-thread stack headroom — see images/runner-rust/Containerfile. A
# pre-started sccache server (no Cargo jobserver) fans rustc codegen out to
# every CPU core; the resulting concurrent LLVM passes can overflow the
# default 8 MiB codegen stack and SIGSEGV rustc. 32 MiB is virtual-only until
# used. Inherited by runner-deb.
ENV RUST_MIN_STACK=33554432
RUN apt-get update && apt-get install -y --no-install-recommends \
rustc \
cargo \
rust-clippy \
rustfmt \
gcc \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL \
"https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
| tar xz -C /tmp \
&& install -m 755 /tmp/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/local/bin/sccache \
&& rm -rf /tmp/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl