Overlapping runs of one Rust job build in separate copies of its folder #333

Merged
merge-queue merged 3 commits from PIPT-91-cargo-slots into main 2026-11-30 18:07:41 -08:00
Owner

Two runs of the same Rust job in one repository (another pull request's, or a matrix entry) shared one kept Cargo build folder. Cargo's lock covers a build, not reading its outputs afterwards, so rustdoc could link an .rlib the other run was replacing: at-terminal PR #63's check-test-linux failed with extern location for rio_window does not exist while PR #64's same job ran in the same folder.

What changes, in suites/rust/cache.mjs:

  • A run takes the first free copy of its job's folder: the usual folder first, then <job>.2, <job>.3 and on. An overlapping run builds at once in its own copy instead of waiting, and a run with no overlap keeps today's warm folder, so no cache goes cold.
  • Linux (containers): the run re-executes under flock -n -s <toolchain>.lock flock -n -E 75 -x <copy>.lock, so the copy is held for the whole job and released when it ends. Exit 75 means another run holds the copy, so it tries the next.
  • Windows and other hosts: the run claims a copy with a <copy>.claim file holding its process id, created exclusively and removed when the process exits. A claim whose process is gone is renamed away before it's taken over, so two runs can't both take it.
  • Removed: nothing. The toolchain cleanup, CARGO_BUILD_BUILD_DIR/CARGO_TARGET_DIR and the CI_CARGO_LOCKED test bypass are unchanged. cargoCache takes the toolchain as an optional second argument so tests needn't run rustc.
  • Cost: each copy is a full build folder, so disk use grows with the most runs of one job that have ever overlapped, until the next toolchain change clears them.

Proof:

  • New tests start two real processes through cargoCache that overlap, check they get different folders, and check that a third, started after the first ends, gets the first's folder. The claim test covers a held claim and taking over a gone one. They pass on Windows (pull-request check, suite-tests-windows); suite-tests-linux runs them through the flock path.
  • The nested flock calls were checked on Linux (util-linux 2.34): 75 while the copy is held, the command's own exit code otherwise, 0 again after release.

Work package: PIPT-91

🤖 Generated with Claude Code

Two runs of the same Rust job in one repository (another pull request's, or a matrix entry) shared one kept Cargo build folder. Cargo's lock covers a build, not reading its outputs afterwards, so rustdoc could link an `.rlib` the other run was replacing: at-terminal PR #63's `check-test-linux` failed with `extern location for rio_window does not exist` while PR #64's same job ran in the same folder. What changes, in `suites/rust/cache.mjs`: - A run takes the first free copy of its job's folder: the usual folder first, then `<job>.2`, `<job>.3` and on. An overlapping run builds at once in its own copy instead of waiting, and a run with no overlap keeps today's warm folder, so no cache goes cold. - Linux (containers): the run re-executes under `flock -n -s <toolchain>.lock flock -n -E 75 -x <copy>.lock`, so the copy is held for the whole job and released when it ends. Exit 75 means another run holds the copy, so it tries the next. - Windows and other hosts: the run claims a copy with a `<copy>.claim` file holding its process id, created exclusively and removed when the process exits. A claim whose process is gone is renamed away before it's taken over, so two runs can't both take it. - Removed: nothing. The toolchain cleanup, `CARGO_BUILD_BUILD_DIR`/`CARGO_TARGET_DIR` and the `CI_CARGO_LOCKED` test bypass are unchanged. `cargoCache` takes the toolchain as an optional second argument so tests needn't run rustc. - Cost: each copy is a full build folder, so disk use grows with the most runs of one job that have ever overlapped, until the next toolchain change clears them. Proof: - New tests start two real processes through `cargoCache` that overlap, check they get different folders, and check that a third, started after the first ends, gets the first's folder. The claim test covers a held claim and taking over a gone one. They pass on Windows (`pull-request check`, suite-tests-windows); suite-tests-linux runs them through the flock path. - The nested `flock` calls were checked on Linux (util-linux 2.34): 75 while the copy is held, the command's own exit code otherwise, 0 again after release. Work package: [PIPT-91](https://openproject.home.romaine.life/wp/PIPT-91) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Overlapping runs of one Rust job build in separate copies of its folder (PIPT-91)
Some checks failed
CI / manifest-check-linux (pull_request) Has been skipped
CI / prune-releases (pull_request) Has been skipped
CI / home-cache-windows (pull_request) Has been skipped
CI / cache-save (ubuntu-latest) (pull_request) Has been skipped
Suite default / scope (pull_request) Successful in 38s
Suite default / check-rules (pull_request) Has been skipped
CI / release-version (pull_request) Has been skipped
CI / check-fetches (pull_request) Has been skipped
CI / check-image-digests (pull_request) Has been skipped
CI / container-health (pull_request) Has been skipped
Fleet / align (pull_request) Successful in 12s
Tofu providers / lock (pull_request) Successful in 14s
CI / cached-images (pull_request) Has been skipped
CI / suite-tests-windows (pull_request) Failing after 32s
CI / cache-save (windows-latest) (pull_request) Has been skipped
CI / setup-windows (pull_request) Failing after 57s
CI / changes (pull_request) Successful in 24s
CI / actionlint (pull_request) Has been skipped
CI / check-versions (pull_request) Has been skipped
CI / azure-cli (pull_request) Has been skipped
CI / home-cache-linux (pull_request) Has been skipped
Suite default / check-fetches (pull_request) Has been skipped
CI / service-runtime (one) (pull_request) Successful in 1m4s
CI / suite-tests-linux (pull_request) Failing after 2m27s
CI / service-runtime (two) (pull_request) Successful in 1m27s
CI / service-cancellation (pull_request) Successful in 1m30s
Suite default / check-logs (pull_request) Successful in 32s
Suite default / reused-checks (pull_request) Successful in 26s
CI / setup-linux (cluster) (pull_request) Successful in 6m32s
merge-queue CI failed: CI / setup-windows (pull_request), CI / suite-tests-linux (pull_request), CI / suite-tests-windows (pull_request)
5e13985681
First-time contributor

merge-queue stopped this at 5e13985: CI failed: CI / suite-tests-windows (pull_request). Push a fix. A failure fixed on main lands once the queue label is removed and added again: the queue merges main in and CI runs on the new head.

merge-queue stopped this at 5e13985: CI failed: CI / suite-tests-windows (pull_request). Push a fix. A failure fixed on main lands once the `queue` label is removed and added again: the queue merges main in and CI runs on the new head.
First-time contributor

merge-queue stopped this at 5e13985: CI failed: CI / setup-windows (pull_request), CI / suite-tests-linux (pull_request), CI / suite-tests-windows (pull_request). Push a fix. A failure fixed on main lands once the queue label is removed and added again: the queue merges main in and CI runs on the new head.

merge-queue stopped this at 5e13985: CI failed: CI / setup-windows (pull_request), CI / suite-tests-linux (pull_request), CI / suite-tests-windows (pull_request). Push a fix. A failure fixed on main lands once the `queue` label is removed and added again: the queue merges main in and CI runs on the new head.
nelson force-pushed PIPT-91-cargo-slots from 5e13985681
Some checks failed
CI / manifest-check-linux (pull_request) Has been skipped
CI / prune-releases (pull_request) Has been skipped
CI / home-cache-windows (pull_request) Has been skipped
CI / cache-save (ubuntu-latest) (pull_request) Has been skipped
Suite default / scope (pull_request) Successful in 38s
Suite default / check-rules (pull_request) Has been skipped
CI / release-version (pull_request) Has been skipped
CI / check-fetches (pull_request) Has been skipped
CI / check-image-digests (pull_request) Has been skipped
CI / container-health (pull_request) Has been skipped
Fleet / align (pull_request) Successful in 12s
Tofu providers / lock (pull_request) Successful in 14s
CI / cached-images (pull_request) Has been skipped
CI / suite-tests-windows (pull_request) Failing after 32s
CI / cache-save (windows-latest) (pull_request) Has been skipped
CI / setup-windows (pull_request) Failing after 57s
CI / changes (pull_request) Successful in 24s
CI / actionlint (pull_request) Has been skipped
CI / check-versions (pull_request) Has been skipped
CI / azure-cli (pull_request) Has been skipped
CI / home-cache-linux (pull_request) Has been skipped
Suite default / check-fetches (pull_request) Has been skipped
CI / service-runtime (one) (pull_request) Successful in 1m4s
CI / suite-tests-linux (pull_request) Failing after 2m27s
CI / service-runtime (two) (pull_request) Successful in 1m27s
CI / service-cancellation (pull_request) Successful in 1m30s
Suite default / check-logs (pull_request) Successful in 32s
Suite default / reused-checks (pull_request) Successful in 26s
CI / setup-linux (cluster) (pull_request) Successful in 6m32s
merge-queue CI failed: CI / setup-windows (pull_request), CI / suite-tests-linux (pull_request), CI / suite-tests-windows (pull_request)
to 7ebb98c07c
Some checks are pending
CI / prune-releases (pull_request) Has been skipped
Suite default / check-rules (pull_request) Has been skipped
Suite default / scope (pull_request) Successful in 28s
CI / cached-images (pull_request) Has been skipped
CI / actionlint (pull_request) Has been skipped
Fleet / align (pull_request) Successful in 12s
CI / container-health (pull_request) Has been skipped
CI / home-cache-linux (pull_request) Has been skipped
CI / home-cache-windows (pull_request) Has been skipped
CI / cache-save (windows-latest) (pull_request) Has been skipped
CI / release-version (pull_request) Has been skipped
CI / changes (pull_request) Successful in 17s
CI / check-fetches (pull_request) Has been skipped
CI / check-image-digests (pull_request) Has been skipped
CI / azure-cli (pull_request) Has been skipped
Suite default / check-fetches (pull_request) Has been skipped
CI / check-versions (pull_request) Has been skipped
Tofu providers / lock (pull_request) Successful in 13s
CI / cache-save (ubuntu-latest) (pull_request) Has been skipped
CI / manifest-check-linux (pull_request) Has been skipped
CI / suite-tests-windows (pull_request) Successful in 2m55s
CI / service-runtime (one) (pull_request) Successful in 1m58s
CI / setup-windows (pull_request) Successful in 8m4s
CI / suite-tests-linux (pull_request) Successful in 1m30s
Suite default / check-logs (pull_request) Successful in 28s
CI / service-runtime (two) (pull_request) Successful in 1m54s
CI / service-cancellation (pull_request) Successful in 1m56s
CI / setup-linux (cluster) (pull_request) Successful in 4m31s
Suite default / reused-checks (pull_request) Successful in 17s
merge-queue 2nd in line, behind #319: fleet.json drops archived at-home-tools, which failed every PR's Fleet / align (PIPT-77)
2026-11-30 16:04:19 -08:00
Compare
Merge branch 'main' into PIPT-91-cargo-slots
All checks were successful
CI / home-cache-windows (pull_request) Has been skipped
CI / container-health (pull_request) Has been skipped
CI / azure-cli (pull_request) Has been skipped
CI / cache-save (windows-latest) (pull_request) Has been skipped
CI / changes (pull_request) Successful in 15s
CI / home-cache-linux (pull_request) Has been skipped
CI / cache-save (ubuntu-latest) (pull_request) Has been skipped
Suite default / scope (pull_request) Successful in 28s
CI / prune-releases (pull_request) Has been skipped
Fleet / align (pull_request) Successful in 9s
CI / actionlint (pull_request) Has been skipped
CI / cached-images (pull_request) Has been skipped
Tofu providers / lock (pull_request) Successful in 8s
CI / release-version (pull_request) Has been skipped
CI / check-versions (pull_request) Has been skipped
CI / check-fetches (pull_request) Has been skipped
CI / check-image-digests (pull_request) Has been skipped
CI / manifest-check-linux (pull_request) Has been skipped
Suite default / check-fetches (pull_request) Has been skipped
Suite default / check-rules (pull_request) Has been skipped
CI / suite-tests-windows (pull_request) Successful in 1m44s
CI / setup-windows (pull_request) Successful in 3m40s
CI / service-cancellation (pull_request) Successful in 43s
Suite default / check-logs (pull_request) Successful in 17s
CI / service-runtime (one) (pull_request) Successful in 36s
CI / service-runtime (two) (pull_request) Successful in 32s
CI / setup-linux (cluster) (pull_request) Successful in 3m42s
CI / suite-tests-linux (pull_request) Successful in 1m19s
Suite default / reused-checks (pull_request) Successful in 32s
merge-queue landed on main
30f2bc6164
merge-queue deleted branch PIPT-91-cargo-slots 2026-11-30 18:07:41 -08:00
Sign in to join this conversation.
No description provided.