GRI-2088: fix ETXTBSY race in pdf.rs and pptx_video acceptance test #332

Merged
vivy merged 2 commits from fix/GRI-2088-pdf-etxtbsy into dev 2026-11-18 23:15:58 +00:00
Member

Fixes the reopened ETXTBSY race (#220): the same race from PR #221 also existed in crates/server/src/pdf.rs and crates/server/tests/pptx_video_acceptance_integration.rs, both via fake_program writing the fake script with std::fs::write in-process while concurrent test threads fork.

fake_program in both files now writes the script through a piped child sh (cat > "$1" && chmod 755 "$1") instead of writing it in-process, so this process never holds a writable fd on the fake program for a concurrent fork() to inherit. Removed the now-unused PermissionsExt import.

Also added {error:?} to the bare assert!(matches!(error, ...)) assertions in pdf.rs and pptx_video.rs, so a recurrence prints the actual error instead of a bare panic.

Evidence:

  • pdf::tests looped 50x with --test-threads=16: 0 failures (previously intermittent ETXTBSY on times_out_when_the_converter_hangs).
  • pptx_video::tests unit suite still green (regression check, same fix as #221).
  • pptx_video_acceptance_integration builds clean (--no-run; DB-gated, not run locally).
  • Full local-gates.sh: all gates passed (Rust + frontend-web).

Blocks #217 (#206), which blocks the redeploy to the campus test servers.

Fixes the reopened ETXTBSY race (#220): the same race from PR #221 also existed in `crates/server/src/pdf.rs` and `crates/server/tests/pptx_video_acceptance_integration.rs`, both via `fake_program` writing the fake script with `std::fs::write` in-process while concurrent test threads fork. `fake_program` in both files now writes the script through a piped child `sh` (`cat > "$1" && chmod 755 "$1"`) instead of writing it in-process, so this process never holds a writable fd on the fake program for a concurrent `fork()` to inherit. Removed the now-unused `PermissionsExt` import. Also added `{error:?}` to the bare `assert!(matches!(error, ...))` assertions in `pdf.rs` and `pptx_video.rs`, so a recurrence prints the actual error instead of a bare panic. **Evidence:** - `pdf::tests` looped 50x with `--test-threads=16`: 0 failures (previously intermittent `ETXTBSY` on `times_out_when_the_converter_hangs`). - `pptx_video::tests` unit suite still green (regression check, same fix as #221). - `pptx_video_acceptance_integration` builds clean (`--no-run`; DB-gated, not run locally). - Full `local-gates.sh`: all gates passed (Rust + frontend-web). Blocks #217 (#206), which blocks the redeploy to the campus test servers.
GRI-2088: fix ETXTBSY race in pdf.rs and pptx_video acceptance test fake_program
All checks were successful
CI / the pre-push hook (pull_request) Successful in 5s
CI / install.sh client upgrade (pull_request) Successful in 19s
CI / cargo fmt (pull_request) Successful in 6s
CI / cargo clippy (pull_request) Successful in 1m52s
CI / cargo deny (pull_request) Successful in 24s
CI / cargo deny advisories (pull_request) Successful in 19s
CI / repository boundary (pull_request) Successful in 5s
CI / frontend-web (pull_request) Successful in 1m24s
CI / cargo test (pull_request) Successful in 5m18s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
10fc752085
Write the fake script via a piped child sh instead of std::fs::write
in-process, matching the fix already applied to pptx_video.rs in #221.
Print the error on the bare assert!(matches!(...)) checks in pdf.rs
and pptx_video.rs so a recurrence shows the actual error.
Merge remote-tracking branch 'origin/dev' into fix/GRI-2088-pdf-etxtbsy
All checks were successful
CI / the pre-push hook (pull_request) Successful in 4s
CI / cargo fmt (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo clippy (pull_request) Successful in 1m6s
CI / cargo deny (pull_request) Successful in 18s
CI / cargo deny advisories (pull_request) Successful in 18s
CI / frontend-web (pull_request) Successful in 1m11s
CI / repository boundary (pull_request) Successful in 5s
CI / cargo test (pull_request) Successful in 4m21s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 2s
2a3f58a95b
vivy approved these changes 2026-11-18 23:06:07 +00:00
vivy left a comment

Reviewed. Same shape as #221: the script is written by a child sh, so this process never holds a writable fd on the fake program for a concurrent fork to inherit; stdin is dropped at the end of the write statement, so cat sees EOF before wait. The {error:?} on the matches! asserts makes a recurrence readable. Up to date with dev. Merge on green cargo test.

Reviewed. Same shape as #221: the script is written by a child sh, so this process never holds a writable fd on the fake program for a concurrent fork to inherit; stdin is dropped at the end of the write statement, so cat sees EOF before wait. The {error:?} on the matches! asserts makes a recurrence readable. Up to date with dev. Merge on green cargo test.
vivy merged commit e2f679edaa into dev 2026-11-18 23:15:57 +00:00
vivy deleted branch fix/GRI-2088-pdf-etxtbsy 2026-11-18 23:15:59 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
Grimoirix/grimoire-of-digital-signage!332
No description provided.