Skip to content

fix: shared flock guard for rustup to prevent parallel build races#21222

Open
AztecBot wants to merge 2 commits intonextfrom
claudebox/a103561d07144777-2
Open

fix: shared flock guard for rustup to prevent parallel build races#21222
AztecBot wants to merge 2 commits intonextfrom
claudebox/a103561d07144777-2

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 6, 2026

Summary

Noir and avm-transpiler builds run in parallel via Make and both trigger rustup to install/use the Rust toolchain from the shared RUSTUP_HOME at /opt/rust/rustup. When the toolchain isn't cached (e.g. on noir sync branches), both try to install simultaneously, causing:

  1. Rustup corruption — concurrent installs race on renaming component files, leaving cargo broken ("the 'cargo' binary is not applicable to the toolchain")
  2. Too many open files — parallel cargo builds exhaust file descriptors (addressed separately by the ulimit bump in f4507cc891)

This PR adds a shared flock at /tmp/rustup.lock across all three scripts that interact with rustup:

  • noir/bootstrap.sh — wraps install_deps (cargo-binstall, just install-rust-tools)
  • avm-transpiler/bootstrap.sh — updates existing local lock (/tmp/rustup-avm-transpiler.lock) to shared path
  • bootstrap.sh — wraps the CI-only rustup toolchain install in check_toolchains

The build image Dockerfile already installs Rust 1.89.0 correctly — this guard prevents races when the toolchain needs runtime installation or when rustup operations overlap.

Context: #20985

ClaudeBox log: http://ci.aztec-labs.com/a103561d07144777-2

@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 6, 2026
@ludamad ludamad marked this pull request as ready for review March 6, 2026 20:16
@ludamad ludamad enabled auto-merge March 6, 2026 20:56
@ludamad ludamad removed the claudebox Owned by claudebox. it can push to this PR. label Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants