Loader: flush VICTORY_PROFILE periodically and on crash/GPU failure #4768
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!4768
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4767"
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?
@dheerajc8073 on GitHub · 2026-12-01 06:34 UTC · original
dheerajc8073:fix/profile-periodic-flush→main· +187 −55 · 2 files · 1 commits · openRefs #4733
What it changes
VICTORY_PROFILE=<from>,<to>,<ms>,<file>previously wrote<file>only after the sampling window ended, so a GPU failure (host_gpu_failed), unhandled exception, or hang before<to>lost all collected samples.<file>every 10 seconds via<file>.tmp+ rename (with copy+remove fallback), without closing thread handles and while preserving the resolved symbol cache across flushes.profile::flush()(usingtry_lockto avoid deadlocks) and calls it fromcrash::log_crashandcrash::report_unhandledwhendiagnosticsis enabled.victory-loader::profile::testscovering incremental snapshot writes, symbol-cache reuse, andflush().How it was tested
cargo testpassed for the crates it touches: yes (victory-loader, default and--all-features, pluscargo clippy --locked -p victory-loader --all-targetswith-D warningsunder both default and--all-features, andcargo xtask policy— note CI workspacecheckcurrently fails on 5 pre-existingvictory-gpuClippy lints onmaintracked by #4708)Checked for overlap
Flush VICTORY_PROFILE periodically and on crash/GPU failureto Loader: flush VICTORY_PROFILE periodically and on crash/GPU failure@andrewpozdnakov7-jpg on GitHub · 2026-12-01 09:24 UTC · original
The snapshot copy fallback can overwrite the last complete profile even after the atomic rename fails. That can leave a partial profile at the published path if the process stops during the copy.
I checked the exact replacement code from
d272c96on Windows with a reader holdingprofile.txt.tmpopen. The rename failed with Windows sharing error 32, but the current fallback returned success and changed what an already-open reader ofprofile.txtsaw fromrounds 1torounds 2in the same file.Proposed commit removes the copy fallback. With the same handles open it returns error 32, preserves
rounds 1and leaves the completerounds 2snapshot in.tmp. Retrying after the handles close publishesrounds 2. The patch changes only snapshot replacement and is based directly on your PR head.Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.@Dukestar69 on GitHub · 2026-12-01 12:06 UTC · original · approved these changes
Reviewed crates/victory-loader/src/crash.rs and crates/victory-loader/src/profile.rs: periodic 10 s snapshots and crash-path profile::flush() via ACTIVE.try_lock() (avoiding deadlock in exception handlers), closing thread handles via Drop on Thread, reusing state.names across snapshots, and writing via .tmp + rename/copy fallback are all clean and well-tested. Verified on Windows: cargo test -p victory-loader --features diagnostics --lib profile::tests -- --test-threads=1 (3 passed, 0 failed) and default-features cargo check -p victory-loader --tests passed cleanly.
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.