Rust tests leave illogical-test-<pid>-<n> state dirs in /tmp #68

Closed
opened 2026-10-02 16:36:15 +00:00 by jhgaylor · 1 comment
Owner

Found during #55 (while fixing #62).

/tmp on geek holds about 1,650 directories named illogical-test-- (about 17 per test run), each a daemon state dir (blocks/, daemon-id, layout.json, push/, shell/, sock). They come from crates/daemon/tests/attach.rs temp_state() (and the same name in upgrade.rs). TempState's Drop calls remove_dir_all, so the likely cause is the daemon (or a pane's shell) still writing there when it runs: e.g. the Daemon is dropped after its TempState, or the daemon saves layout.json on its way out after the directory is gone.

Next steps: check drop order in attach.rs/upgrade.rs (kill and wait for the daemon before removing its state), and retry remove_dir_all once the child has exited, as fake-fleet.ts does.

Found during #55 (while fixing #62). /tmp on geek holds about 1,650 directories named illogical-test-<pid>-<n> (about 17 per test run), each a daemon state dir (blocks/, daemon-id, layout.json, push/, shell/, sock). They come from crates/daemon/tests/attach.rs temp_state() (and the same name in upgrade.rs). TempState's Drop calls remove_dir_all, so the likely cause is the daemon (or a pane's shell) still writing there when it runs: e.g. the Daemon is dropped after its TempState, or the daemon saves layout.json on its way out after the directory is gone. Next steps: check drop order in attach.rs/upgrade.rs (kill and wait for the daemon before removing its state), and retry remove_dir_all once the child has exited, as fake-fleet.ts does.
Author
Owner

Fixed in main (356fbcf, from 1e412d7). Cause: a pane's shim outlives the test daemon and appends signal N to blocks/<id>/process when the program dies. If that lands during remove_dir_all, blocks/<id> isn't empty and the delete gives up. strays::remove now kills, waits for the shims to record the end, and retries the delete; every teardown uses it. Also fixed: the forge tests' scratch dirs (38 per run) and dialout's token dirs (4 per run) were never deleted. Measured: 3 leftovers in 10 runs of attach+upgrade before, 0 in 20 after; 0 left by three full cargo test -p illogicald runs and a full workspace run.

Fixed in main (356fbcf, from 1e412d7). Cause: a pane's shim outlives the test daemon and appends `signal N` to `blocks/<id>/process` when the program dies. If that lands during `remove_dir_all`, `blocks/<id>` isn't empty and the delete gives up. `strays::remove` now kills, waits for the shims to record the end, and retries the delete; every teardown uses it. Also fixed: the forge tests' scratch dirs (38 per run) and dialout's token dirs (4 per run) were never deleted. Measured: 3 leftovers in 10 runs of attach+upgrade before, 0 in 20 after; 0 left by three full `cargo test -p illogicald` runs and a full workspace run.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
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
jhgaylor/illogical#68
No description provided.