Loader: serialize crash-log appends in a single write #2403
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2403
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2403/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ashrafsdrop on GitHub · 2026-11-25 13:02 UTC · original
ashrafsdrop:loader/crash-log-serialize-2025→main· +49 −2 · 1 files · 1 commits · closed without mergingAddresses the crash-log interleaving reported in #2025:
Summary
crates/victory-loader/src/crash.rs,append_to_logpreviously usedwrite!(f, ...)without a lock, issuing multipleWrite::writecalls that interleaved mid-report when concurrent threads hit exceptions or panics.append_to_fileto format the entire entry into a single buffer and write it viawrite_allunder a staticLOG_LOCKmutex.Verification
concurrent_crash_log_appends_do_not_interleave(8 threads x 25 multi-line appends verified intact).cargo test -p victory-loader(35 unit + 4 integration tests passed).cargo clippy -p victory-loader --all-targets --all-features -- -D warnings(clean).cargo run -p xtask -- policy(182 files ok).@Marvisak on GitHub · 2026-11-25 15:30 UTC · original
Automated triage for the maintainers.
Merge candidate (worth a look). This fixes interleaved entries in
crashes.log(#2025).append_to_logincrates/victory-loader/src/crash.rsusedwrite!on an unbufferedFile, which writes in several pieces, so two threads crashing or panicking together could mix their reports. Each entry is now formatted into one buffer and written with a singlewrite_allunder a staticLOG_LOCK. I checked that all three callers (the panic hook,log_crash, the exception handler) still go through it, thattempfileis already a loader dev-dependency, and thatas_chunksis already used in the workspace. Residual risk: the exception handler now takes a lock, so a fault on a thread already inside this write would wait on itself; that case is very narrow. CI: passing.Generated by Claude Code
@cloph-dsp on GitHub · 2026-11-25 15:42 UTC · original
Independent local validation, PR #2403 (Windows, Rust 1.100.0/MSVC, head
ed3d01a, no game data):cargo test --locked -p victory-loader --lib-> 35 tests passed, 0 failed, 0 ignored, exit 0;git diff --checkclean. CPU-only regression run; the single-write crash-log append scenario was not replayed. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU tests). No game data or third-party assets used.@Marvisak on GitHub · 2026-11-25 22:09 UTC · original
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing in favour of #2033, which makes the same single buffered write without the mutex. One
WriteFileon an append handle already lands whole across threads and processes. The lock adds nothing on top and sits in the exception path, where a thread that faults or is ended while holding it would block every later crash report.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed