Loader: append crash reports as single records (port of upstream #2033) #1328

Closed
github-bot wants to merge 1 commit from github-bot/gh-1328 into main AGit
Owner

@⁠CwWwWwW on GitHub · 2026-11-26 15:34 UTC · original
CwWwWwW:port/crash-single-record → main · +58 −4 · 1 files · 1 commits · closed without merging

Problem

The crash log is the only record of a crash after the console is gone. append_to_log formatted the record straight into the file with write!(), which may append its fragments separately; with more than one thread crashing at once, one report's header/body can be split by another's pieces and the log can no longer be read back.

Upstream VIctory fixed this in commit a7560bf (pull request #2033, by BaggyALPHA); this is that fix ported to the fork.

Change

  • The record is formatted into a buffer first.
  • It is appended with a single write(); a short write is reported as WriteZero instead of retried (a retry could put another report between the pieces).
  • append_to_log keeps its signature and only logs a failure; no lock is acquired in the exception handler path.

Tests

  • New concurrent_crash_records_stay_together: 8 threads x 16 records x 8 KiB bodies; every record must have a complete header, identifier and body line in order.
  • cargo test -p victory-loader --lib --locked: 28 passed, 0 failed.
  • cargo clippy -p victory-loader --all-targets --locked -- -D warnings: clean.
  • No game or GPU needed.

(CI note: the check job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)

**@⁠CwWwWwW** on GitHub · 2026-11-26 15:34 UTC · [original](https://github.com/fxceless/victory-fork/pull/1328) `CwWwWwW:port/crash-single-record` → `main` · +58 −4 · 1 files · 1 commits · closed without merging ## Problem The crash log is the only record of a crash after the console is gone. append_to_log formatted the record straight into the file with write!(), which may append its fragments separately; with more than one thread crashing at once, one report's header/body can be split by another's pieces and the log can no longer be read back. Upstream VIctory fixed this in commit a7560bf (pull request #2033, by BaggyALPHA); this is that fix ported to the fork. ## Change - The record is formatted into a buffer first. - It is appended with a single write(); a short write is reported as WriteZero instead of retried (a retry could put another report between the pieces). - append_to_log keeps its signature and only logs a failure; no lock is acquired in the exception handler path. ## Tests - New concurrent_crash_records_stay_together: 8 threads x 16 records x 8 KiB bodies; every record must have a complete header, identifier and body line in order. - cargo test -p victory-loader --lib --locked: 28 passed, 0 failed. - cargo clippy -p victory-loader --all-targets --locked -- -D warnings: clean. - No game or GPU needed. (CI note: the check job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)
Ported from upstream VIctory commit a7560bf (pull request #2033,
BaggyALPHA): append_to_log formatted the crash record straight into the
file with one write! call, which may append its fragments separately. Two
threads crashing at once could then put one report's header and body
between another's pieces, leaving a crash log that cannot be read back -
the file crash reports are appended to is the only record of a crash
after the console is gone.

The record is formatted first and appended with one write; a short write
is reported as WriteZero instead of retried, since retrying could put
another report between the pieces. append_to_log keeps its signature and
only logs a failure.

Test: concurrent_crash_records_stay_together (8 threads, 16 records each,
8 KiB bodies; every header, identifier and body line must be complete and
in order). cargo test -p victory-loader --lib: 28 passed, 0 failed;
cargo clippy -p victory-loader --all-targets -- -D warnings: clean.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:35:22 +00:00
github-bot closed this pull request 2026-11-26 15:52:09 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.