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

Closed
CwWwWwW wants to merge 1 commit from upstream-pr/1328 into main
CwWwWwW commented 2026-11-26 15:34:51 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-26T15:34:51Z.


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.)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6630026511 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1328). Originally posted by [CwWwWwW](https://github.com/CwWwWwW) on 2026-11-26T15:34:51Z. --- ## 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.)
upstream-sync closed this pull request 2026-11-26 16:06:35 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!1325
No description provided.