OOM with rustc 1.65 on `i686-unknown-linux-gnu` target

Thought I'd run this by here before opening a bug report, especially to see if anyone has encountered anything similar.

I've started encountering what looks like an OOM (i.e. SIGKILL) on GitHub Actions when building the p384 crate on an i686-unknown-linux-gnu target (i.e. targeting the 32-bit ABI on a 64-bit runner).

It's definitely reproducible... I've tried rerunning the build several times and it OOMs consistently.

error: could not compile p384

Caused by: process didn't exit successfully: rustc --crate-name p384 --edition=2021 /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/p384-0.11.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on --cfg 'feature="arithmetic"' --cfg 'feature="digest"' --cfg 'feature="ecdsa"' --cfg 'feature="ecdsa-core"' --cfg 'feature="sha2"' --cfg 'feature="sha384"' --cfg 'feature="std"' -C metadata=6a9d89a087778ac2 -C extra-filename=-6a9d89a087778ac2 --out-dir /home/runner/work/SSH/SSH/target/i686-unknown-linux-gnu/debug/deps --target i686-unknown-linux-gnu -L dependency=/home/runner/work/SSH/SSH/target/i686-unknown-linux-gnu/debug/deps -L dependency=/home/runner/work/SSH/SSH/target/debug/deps --extern ecdsa_core=/home/runner/work/SSH/SSH/target/i686-unknown-linux-gnu/debug/deps/libecdsa-e9a05a85727402e3.rmeta --extern elliptic_curve=/home/runner/work/SSH/SSH/target/i686-unknown-linux-gnu/debug/deps/libelliptic_curve-5e8ca8c7d8361b39.rmeta --extern sha2=/home/runner/work/SSH/SSH/target/i686-unknown-linux-gnu/debug/deps/libsha2-8ef67c7ec61f05ea.rmeta --cap-lints allow -Dwarnings (signal: 9, SIGKILL: kill)

Error: Process completed with exit code 101.

Notably the problem does not occur on Rust 1.60 on i686-unknown-linux-gnu on the same runners, or on 1.65.0 when targeting x86_64-unknown-linux-gnu

What is the peak memory usage of compiling that crate on x86_64?

Suggestions for how I could instrument GitHub Actions to get that figure?

/usr/bin/time command (not the shell built-ins) tracks peak memory usage:

$ =time cat
0.00user 0.00system 0:00.43elapsed 0%CPU (0avgtext+0avgdata 2040maxresident)k
0inputs+0outputs (0major+147minor)pagefaults 0swaps

I forget what it does for process trees. systemd-run can also be used to put caps on memory usage, though is unlikely to work in most Docker containers:

$ systemd-run --same-dir --ptr -p MemoryHigh=4G -p MemoryMax=6G …
1 Like

@mathstuf hmm, getting the usage for the child rustc process seems pretty important.

Another data point: switching to a release build seems to have fixed the issue.