Stop leaking 66 MB knob-lab scaffolds into /tmp per test run #257

Closed
opened 2026-07-13 16:31:19 +02:00 by claude · 0 comments
Collaborator

project_sweep_campaign.rs's built_scale_project() scaffolds knob-lab + a built knob-lab-nodes crate (~66 MB, mostly the node crate's target/) into std::env::temp_dir().join(format!("aura-235-{pid}")) (crates/aura-cli/tests/project_sweep_campaign.rs:70 at d1b9d2b). The wipe on the next line (remove_dir_all(&base)) clears only the CURRENT process's base — the name is pid-suffixed, so no run ever reclaims a previous run's directory. Net effect: one leaked ~66 MB directory per test-binary process, forever.

Observed 2026-07-13: 159 aura-235-* directories totalling ~10 GB filled the host's 16 GB /tmp tmpfs to 100 %, breaking unrelated tempdir consumers (any test using std::env::temp_dir(), i.e. the whole fresh_project() E2E suite) until manually cleared.

Fix shape: anchor the scaffold at a process-independent path on real disk — CARGO_TARGET_TMPDIR (cargo sets it for integration-test builds; resolves to target/tmp, covered by cargo clean) joined with a fixed name — so the existing wipe-before-scaffold reclaims the previous run's copy and the steady state is exactly one directory. Trade-off accepted: two concurrent cargo test invocations over the same checkout would collide on the fixed name, a documented pre-existing caveat class for this suite (the shared-store race note in tests/common/mod.rs's history, #223) — the pid suffix protected that scenario at the price of the unbounded leak.

`project_sweep_campaign.rs`'s `built_scale_project()` scaffolds `knob-lab` + a built `knob-lab-nodes` crate (~66 MB, mostly the node crate's `target/`) into `std::env::temp_dir().join(format!("aura-235-{pid}"))` (crates/aura-cli/tests/project_sweep_campaign.rs:70 at `d1b9d2b`). The wipe on the next line (`remove_dir_all(&base)`) clears only the CURRENT process's base — the name is pid-suffixed, so no run ever reclaims a previous run's directory. Net effect: one leaked ~66 MB directory per test-binary process, forever. Observed 2026-07-13: 159 `aura-235-*` directories totalling ~10 GB filled the host's 16 GB `/tmp` tmpfs to 100 %, breaking unrelated tempdir consumers (any test using `std::env::temp_dir()`, i.e. the whole `fresh_project()` E2E suite) until manually cleared. Fix shape: anchor the scaffold at a **process-independent** path on real disk — `CARGO_TARGET_TMPDIR` (cargo sets it for integration-test builds; resolves to `target/tmp`, covered by `cargo clean`) joined with a fixed name — so the existing wipe-before-scaffold reclaims the previous run's copy and the steady state is exactly one directory. Trade-off accepted: two concurrent `cargo test` invocations over the same checkout would collide on the fixed name, a documented pre-existing caveat class for this suite (the shared-store race note in `tests/common/mod.rs`'s history, #223) — the pid suffix protected that scenario at the price of the unbounded leak.
claude added the bug label 2026-07-13 16:31:19 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/Aura#257