test: attachment crash scan races with background temporary-file cleanup #1060

Open
opened 2026-11-10 14:48:59 +00:00 by kayg · 1 comment
Owner

While qualifying #1051, cargo test -j4 -p calternal --test attachments_crash kill_nine_mid_upload_leaves_nothing_half_written -- --exact failed with NotFound at attachments_crash.rs:129 between read_dir and DirEntry::metadata. Branch 898d7f865: 1/10 failed. Dev 4274dafb4: first 10/10 passed; expanded diagnostic runs 11–30 had 1 failure (run 15), so 1/30 failed overall. Both failures have the identical location and error.

The restart intentionally removes temporary uploads in the background while files() scans them. Trivial repair: skip only NotFound for .calternal-tmp-* entries and retain strict errors for real files. Qualification and raw logs will be attached to the #1051 PR comments.

While qualifying #1051, `cargo test -j4 -p calternal --test attachments_crash kill_nine_mid_upload_leaves_nothing_half_written -- --exact` failed with `NotFound` at attachments_crash.rs:129 between read_dir and DirEntry::metadata. Branch 898d7f865: 1/10 failed. Dev 4274dafb4: first 10/10 passed; expanded diagnostic runs 11–30 had 1 failure (run 15), so 1/30 failed overall. Both failures have the identical location and error. The restart intentionally removes temporary uploads in the background while files() scans them. Trivial repair: skip only NotFound for .calternal-tmp-* entries and retain strict errors for real files. Qualification and raw logs will be attached to the #1051 PR comments.
Author
Owner

The listing race is fixed on #1051 branch (test-only commit da8e35728, formatted in f972d0b6e). The helper now reads metadata once, skips only vanished .calternal-tmp-* entries, and still fails on other metadata errors.

Reproduction: branch 898d7f865 failed 1/10 (run 7); dev 4274dafb4 failed 1/30 (run 15, after the initial 10 passed). Both failed at the same metadata unwrap with NotFound. After the fix, 20/20 repeated runs passed. Command for each run: ~/bin/slot nix develop -c bash -c "cargo test -j4 -p calternal --test attachments_crash kill_nine_mid_upload_leaves_nothing_half_written -- --exact" (loops share one slot/Nix shell). Logs attached to this comment.

The listing race is fixed on #1051 branch (test-only commit da8e35728, formatted in f972d0b6e). The helper now reads metadata once, skips only vanished `.calternal-tmp-*` entries, and still fails on other metadata errors. Reproduction: branch 898d7f865 failed 1/10 (run 7); dev 4274dafb4 failed 1/30 (run 15, after the initial 10 passed). Both failed at the same metadata unwrap with NotFound. After the fix, 20/20 repeated runs passed. Command for each run: `~/bin/slot nix develop -c bash -c "cargo test -j4 -p calternal --test attachments_crash kill_nine_mid_upload_leaves_nothing_half_written -- --exact"` (loops share one slot/Nix shell). Logs attached to this comment.
Sign in to join this conversation.
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
kayg/calternal#1060
No description provided.