loader(crash): append crash report records in a single write #121

Manually merged
github merged 1 commit from gh-pr/121/head into gh-pr/121/base 2026-12-01 20:11:16 +00:00
Owner

@⁠Androtim on GitHub · 2026-11-29 13:05 UTC · original
Androtim:feat/iter122-loader-atomic-crash-append → main · +58 −4 · 1 files · 1 commits · merged 2026-11-29 14:05 UTC

Summary

  • Extract append_record(file, text) in crates/victory-loader/src/crash.rs to format the full crash report string first and append it via a single file.write(record.as_bytes()) call, avoiding interleaved fragments when concurrent threads fault simultaneously.
  • Return ErrorKind::WriteZero on short writes without retrying (since retrying could interleave another thread's report between fragments), still lock-free for exception-handler safety.
  • Add concurrent_crash_records_stay_together verifying 8 threads concurrently appending 16 8 KiB records produce intact non-interleaved reports.

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: asset policy: 303 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-loader --lib --locked -- crash::: 20 passed; 0 failed
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings and --features diagnostics: 0 code warnings
**@⁠Androtim** on GitHub · 2026-11-29 13:05 UTC · [original](https://github.com/Androtim/MiniVI/pull/121) `Androtim:feat/iter122-loader-atomic-crash-append` → `main` · +58 −4 · 1 files · 1 commits · merged 2026-11-29 14:05 UTC ## Summary - Extract `append_record(file, text)` in `crates/victory-loader/src/crash.rs` to format the full crash report string first and append it via a single `file.write(record.as_bytes())` call, avoiding interleaved fragments when concurrent threads fault simultaneously. - Return `ErrorKind::WriteZero` on short writes without retrying (since retrying could interleave another thread's report between fragments), still lock-free for exception-handler safety. - Add `concurrent_crash_records_stay_together` verifying 8 threads concurrently appending 16 `8 KiB` records produce intact non-interleaved reports. ## Verification - `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy`: `asset policy: 303 files ok` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-loader --lib --locked -- crash::`: **20 passed; 0 failed** - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings` and `--features diagnostics`: **0 code warnings**
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:11:14 +00:00
github manually merged commit 16f79e48e6 into gh-pr/121/base 2026-12-01 20:11:16 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-29 14:02 UTC · original

Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Clean, focused fix with solid test coverage and passing CI.

Review Notes

  • crates/victory-loader/src/crash.rs (append_to_log, append_record): Previously, write!(f, ...) issued multiple unbuffered File::write_all calls per crash report (one per format literal/argument), allowing concurrent faulting threads to interleave fragments in the crash log. Formatting the full record into a single buffer and appending it with one file.write(record.as_bytes()) call avoids fragment interleaving without introducing a mutex that could deadlock inside an exception handler.
  • Returning ErrorKind::WriteZero on a short write rather than retrying is the right trade-off here (avoiding split appends), and append_to_log preserves best-effort fire-and-forget semantics.
  • concurrent_crash_records_stay_together: Verifies 8 concurrent threads × 16 records of 8 KiB each produce intact, non-interleaved 3-line records with exact set coverage and clean temp-dir cleanup.

No GPU or runtime rendering paths are affected; ready as a merge candidate.


Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-11-29 14:02 UTC · [original](https://github.com/Androtim/MiniVI/pull/121#issuecomment-7256994553) <!-- minivi-triage v1 head=16f79e48e69b78df7692ee92092f3fe868557565 verdict=merge-candidate ci=passing at=2026-11-29T14:03:09Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` Clean, focused fix with solid test coverage and passing CI. ### Review Notes - **`crates/victory-loader/src/crash.rs` (`append_to_log`, `append_record`)**: Previously, `write!(f, ...)` issued multiple unbuffered `File::write_all` calls per crash report (one per format literal/argument), allowing concurrent faulting threads to interleave fragments in the crash log. Formatting the full record into a single buffer and appending it with one `file.write(record.as_bytes())` call avoids fragment interleaving without introducing a mutex that could deadlock inside an exception handler. - Returning `ErrorKind::WriteZero` on a short write rather than retrying is the right trade-off here (avoiding split appends), and `append_to_log` preserves best-effort fire-and-forget semantics. - **`concurrent_crash_records_stay_together`**: Verifies 8 concurrent threads × 16 records of 8 KiB each produce intact, non-interleaved 3-line records with exact set coverage and clean temp-dir cleanup. No GPU or runtime rendering paths are affected; ready as a merge candidate. --- _Generated with Antigravity CLI (`agy`)._
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/Androtim--MiniVI!121
No description provided.