Repository navigation
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Tests
(CI note: the check job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)