fix: lower release opt-level to 2 for amd64 build memory budget #57

Merged
gofix merged 1 commit from fix/amd64-build-opt-level-2 into master 2026-05-03 16:41:52 +00:00
Owner

Refs #53.

Background

#56 added CARGO_BUILD_JOBS=1 + CODEGEN_UNITS=256 and the amd64 build went from 1m11s to 2m7s before OOMing again. Same SIGKILL signature, same unrecoverable Forgejo logs.

Fix

Drop release opt-level from 3 to 2. portal-relay is an I/O-bound network relay; the runtime difference between -O2 and -O3 is in the noise for the workload, and the rustc memory difference is measurable. -O2 is what most distros ship for serverside Rust binaries.

Validation

  • cargo fmt --check clean
  • cargo test --locked 86 passed, 3 ignored
  • cargo clippy --locked --all-targets -- -D warnings clean

Will validate the actual amd64 image build with another v0.0.0-debug-amd64-2 tag after merge.

Refs #53. ## Background #56 added `CARGO_BUILD_JOBS=1` + `CODEGEN_UNITS=256` and the amd64 build went from 1m11s to 2m7s before OOMing again. Same SIGKILL signature, same unrecoverable Forgejo logs. ## Fix Drop release `opt-level` from 3 to 2. portal-relay is an I/O-bound network relay; the runtime difference between -O2 and -O3 is in the noise for the workload, and the rustc memory difference is measurable. -O2 is what most distros ship for serverside Rust binaries. ## Validation - `cargo fmt --check` clean - `cargo test --locked` 86 passed, 3 ignored - `cargo clippy --locked --all-targets -- -D warnings` clean Will validate the actual amd64 image build with another `v0.0.0-debug-amd64-2` tag after merge.
fix: lower release opt-level to 2 for amd64 build memory budget
All checks were successful
Rust CI / Format, lint, and test (pull_request) Successful in 1m25s
b7388d9a64
PR #56 added `CARGO_BUILD_JOBS=1` and `CODEGEN_UNITS=256`. The amd64
Kaniko build then ran further (1m11s -> 2m7s) but still OOMed during
rustc, with logs once again unrecoverable through the Forgejo Actions
API.

Drop release opt-level from 3 to 2. portal-relay is an I/O-bound
network relay where the runtime difference between -O2 and -O3 is in
the noise; the rustc memory difference is measurable and lets the
build fit on the amd64 runner without depending on swap.

LTO is still off (default), debug info is still stripped, and other
release-profile defaults are unchanged.

Refs #53.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gofix merged commit 06aa6bd29f into master 2026-05-03 16:41:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gofix/portal-tunnel-rs!57
No description provided.