Repository navigation
Conversation
…city WriteFile only promises atomicity for a single sector, and a crash record spans many: another reporter can write between its bytes even with FILE_APPEND_DATA, and under Wine the concurrent-records test saw it happen. Each record is written in one append under a process-local lock. A handler never waits on it for long, since an exception may come from the thread that holds it: one that cannot take it still writes, as a rare interleaving beats losing the report.
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64:
cargo test -p victory-loader crash::tests -- --test-threads=1: all tests passed (includingconcurrent_crash_records_stay_together).cargo clippy -p victory-loader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal
left a comment
There was a problem hiding this comment.
Tested natively on Windows 11 x64 (rustc 1.98.1):
cargo clippy -p victory-loader --all-targets --locked -- -D warnings(default and--all-features): clean.cargo test -p victory-loader --locked: 39 passed, 0 failed (35 unit tests +crash_log+load_probe+title_dlls).crash::tests::concurrent_crash_records_stay_together: 10/10 consecutive runs passed.cargo xtask policy: 191 files ok.
The bounded try_lock + yield_now wait (append_guard) with poisoned-lock recovery and timeout fallback is a pragmatic way to serialize multi-thread crash appends without risking self-deadlock if an exception fires while holding the lock.
Two minor non-blocking suggestions:
- In
append_record, acquiring_guardafterOpenOptions::new().create(true).append(true).open(file)?(so the mutex only guards thefile.write(record.as_bytes())call rather than handle open/close, which can take milliseconds under Windows AV minifilters) would shrink the critical section and make the 10 ms timeout much less likely to trip under burst contention—FILE_APPEND_DATAalready seeks atomically per write across separate handles. - Adding a small unit test that holds
APPENDINGon the current thread and verifiesappend_recordstill completes after the ~10 ms timeout would directly cover the re-entrancy fallback path.
LGTM.
|
Automated triage for the maintainers. Merge candidate. CI: passing. Generated by Claude Code |
…NV checkpoints & gamesave recovery Wave 29G — P1 world-entry crash forensics, GPU diagnostic breadcrumbs, Win11 scheduling, and save recovery: - runtime/src/main.cpp: - Emit full single-line crash records with access kind, faulting VA, x64 registers (rip/rsp/rax/rcx/rdx/r8/r9), and tid under a 10 ms short-timeout atomic spin guard (adapted from Marvisak/VIctory#3092, GPL-3.0, author neonbyte1) and tee to auto_session_recorder(). - Add opt-in full-memory minidump writing via dynamic dbghelp.dll MiniDumpWriteDump when LEONIDA_CRASH_DUMP_DIR is set (adapted from Geckomacabre/vx-layer@707b75b, GPL-3.0, author Geckomacabre). - Add Windows 11 EcoQoS execution-speed throttling opt-out (PROCESS_POWER_THROTTLING_EXECUTION_SPEED, disable with LEONIDA_EFFICIENCY_MODE=1) and ABOVE_NORMAL process priority class (disable with LEONIDA_PROCESS_PRIORITY=normal|0), alongside 1 ms timer resolution opt-out (adapted from JMAN730/project-flamingo#796, GPL-3.0, author fever308). - runtime/src/vulkan_device_markers.h + runtime/src/vulkan_device_fault.h: - Add standalone GPU breadcrumb marker history & VK_AMD_buffer_marker helper header (adapted from ubiquitarianism/leonida#2187, GPL-3.0, author aslan2142) ready for Wave 30 wiring. - Enhance VK_NV_device_diagnostic_checkpoints reporting with human-readable Vulkan pipeline stage names, structured nv_device_fault_checkpoint_lines(), truncation notices, and per-loss summary line. - runtime/shims/xgameruntime_gamesave.cpp + runtime/test/xgameruntime_gamesave_test.cpp: - Fix E_GS_PROVIDED_BUFFER_TOO_SMALL (0x80830007) on compact GDK caller buffers (sizeof(XGameSaveBlob)*N + sum(data + name + 1) without 8-byte padding) while keeping 8-byte alignment when room permits and logging have/need/blobs on genuine buffer-too-small errors. - Harden manifest recovery (after Marvisak/VIctory#1981, GPL-3.0, author WerG0D): corrupt .commit restores ~prev backups instead of deleting them; directory-in-place-of-blob rolls back cleanly; present 0-byte blobs roll forward; unrecoverable missing-blob containers preserve .commit and refuse torn reads/updates. - Add 5 unit test scenarios covering compact GDK buffer reads and interrupted/corrupt/unrecoverable manifest recovery.
Split out of #2973, as asked in its review.
WriteFileonly promises an atomic append for a single sector, and a crash record spans many. Under Wine,crash::tests::concurrent_crash_records_stay_togethersaw two records interleave: it writes from several threads of one process, which is the case this fixes.Each record is now written in one append, under a process-local lock. The handler doesn't wait on it for long, because the exception may come from the thread that holds it. After about 10 ms it writes anyway: a rare interleaving is better than a lost report.
Two processes writing the same log aren't covered; the lock is process-local. I haven't seen that happen, and covering it would need a named mutex taken from inside an exception handler, which I'd rather not add without a case for it.
Tested (Linux, GE-Proton11-14 Wine, RTX 5090):
victory-loadertests undercargo xtask wine-test(#1218), 39 passed, 0 failed. Not run on Windows.AI-assisted (Claude); measured on my machine, no game data shared.