Persist crash records before writing stderr and ignore stderr write failures #4976
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4976
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4975"
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?
@mia03ther on GitHub · 2026-12-01 16:10 UTC · original
mia03ther:fix/crash-stderr-panic→main· +80 −16 · 1 files · 1 commits · openFixes #4974
What it changes
On Windows, when the process's stderr handle hits quota/pipe failure (
os error 1453—ERROR_NOT_ENOUGH_QUOTA/"配额不足,无法完成请求的服务。"— oros error 109broken pipe), Rust's standardeprint!/eprintln!and default panic hook panic:crates/victory-loader/src/crash.rs,log_crashcalledeprint!("{text}")beforeappend_to_log(&text). Wheneprint!panicked inside an FFI /extern "system"frame (or unwound before reachingappend_to_log), the host GPU failure message was completely lost fromcrashes.logand aborted the process withpanic in a function that cannot unwind.log_crashes_to, the installed panic hook invokedstd::panic::take_hook()beforeappend_to_log(...), so if stderr was failing, the default hook panicked recursively before writing the panic record tocrashes.log.report()(called fromextern "system"unhandled-exception and vectored-exception handlers),eprintln!/eprint!ran beforeappend_to_log(&text).Changes in
crates/victory-loader/src/crash.rs:write_stderr_to/write_stderrhelpers (let _ = writer.write_all(text.as_bytes());).log_crash_withsolog_crashpersists the record to the crash file first, then writes to stderr without panicking on write errors.log_crashes_to's panic hook to format and append the panic record viaappend_to_logfirst, then best-effort write the standard panic message (and captured backtrace, if any) viawrite_stderr.report()to write header/frame lines to stderr viawrite_stderrand persisttext(append_to_log) before writingtitle_output()(and anydiagnosticssave_on_crashlines) viawrite_stderr.crash::tests::log_crash_persists_record_when_stderr_fails_inside_ffiexercising failing stderr (os error 1453and109) inside anextern "system"frame.How it was tested
victory-loaderstartup/crash path only; reproduced the liveos error 1453+panic in a function that cannot unwindfailure on Windows 11 withv2026.11.30.03).log_crashandreportinvokedeprint!/eprintln!before writingcrashes.log, causingfailed printing to stderr: ... (os error 1453)and aborting viapanic in a function that cannot unwindwith missingcrashes.logentries.log_crashwrites the full record tocrashes.logfirst and ignores stderr write failures cleanly.cargo testpassed for the crates it touches:cargo clippy -p victory-loader --all-targets --locked -- -D warnings: passed (0 warnings/errors)cargo clippy -p victory-loader --all-targets --all-features --locked -- -D warnings: passed (0 warnings/errors)cargo test -p victory-loader --locked:77 passed; 0 failed(src\lib.rs),2 passed; 0 failed(tests\load_probe.rs),2 passed; 0 failed(tests\title_dlls.rs)cargo test -p victory-loader --lib --all-features --locked -- --test-threads=1:80 passed; 0 failed(parallel--all-featurescan hit a pre-existing0xc0000005around concurrent cross-thread stack-unwind tests instacks::tests::another_threads_stack_unwinds_to_its_start)cargo test --locked -p victory-core -p victory-pe:24 passed; 0 failed(victory-core),36 passed; 0 failed(victory-pe)cargo xtask policy: passed (asset policy: 464 files ok)cargo clippy --workspace --all-targets --locked -- -D warningsonorigin/main(5fabb46) currently fails on 5 pre-existing lint errors incrates/victory-gpu/src/host/{font.rs,menu.rs,panel.rs}tracked by #4708.Checked for overlap
stderr,1453,cannot unwind,crash.rs). Related PRs touchingcrates/victory-loader/src/crash.rs: #4768 (VICTORY_PROFILEperiodic/crash flush) and #4132 (stacks: scheduled dumps also go to the crash log). Neither handles stderr write failures (os error 1453) or non-panicking stderr emission in crash/panic handlers.@Dukestar69 on GitHub · 2026-12-01 16:22 UTC · original · approved these changes
Reviewed crates/victory-loader/src/crash.rs: persisting crash records to crashes.log before writing to stderr and ignoring stderr write errors (write_stderr_to) prevents stderr quota/pipe failures or panics from losing crash diagnostics inside panic hooks and non-unwinding exception handlers. Verified on Windows: cargo test -p victory-loader --lib crash::tests -- --test-threads=1 (22 passed, 0 failed, including log_crash_persists_record_when_stderr_fails_inside_ffi).
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.