Pipeline book: keep a batch that failed to write; flush at the end and on a GPU failure (#41) #88
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!88
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/88/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?
@sharan104 on GitHub · 2026-11-26 02:51 UTC · original
sharan104:fix/41-known-flush→main· +74 −13 · 3 files · 1 commits · closed without mergingFixes #41.
known::flush()took the batch out of the book before writing and returned on the first error, so a failed write (a scanner or backup agent holding the file, a full disk) silently dropped pipelines the book already counted as known. Only the two-second timer flushed, so the last batch before the process ended was lost too.What changes:
keys, which is right now: they are still on their way to the file.set_len), so a later append never follows a torn entry. (The file is openedwrite, notappend, because on Windows an append-only handle cannotset_len.)save_pipeline_cache()(the title's end,lifecycle::end) andhost::fail()(before the report ends the process withTerminateProcess, which is how most runs in the tracker end) now flush the book too.WRITINGmutex keeps the timer and those two from adding to the same file at once.Tests:
cargo test -p victory-gpu --locked pipeline::known(3 passed, including the newwhat_is_not_written_is_kept: a failing pipelines file, the batch kept behind later notes, the next write appending both).cargo build --locked --profile diag -p victory --features diagnosticsbuilds. Clippy has no new warnings in the touched files (the twodrop(...insert(..))warnings inknown.rswere already there).Not tested: a real run with the title. There are no game files on this machine, so the failure path is covered by the unit test only.
🤖 Generated with Claude Code
@sharan104 on GitHub · 2026-11-26 02:55 UTC · original
Closing as a duplicate of #63 by @Yoshi-233, which fixes #41 the same way and was opened first. It also keeps partially written bytes and flushes when the title's main thread returns.
One idea from this PR that #63 says it leaves out: the "forced termination on device removal" case. Here,
host::fail()calledcrate::pipeline::known::flush()after itstracing::error!and beforeON_FAILURE's report ends the process withTerminateProcess. With #63'sWRITERmutex this is safe to add (the book lock is never held whilefailruns). Since device removal is how most runs in the tracker end, the last batch is usually the one lost. Feel free to take it into #63 if it's useful.@Yoshi-233 on GitHub · 2026-11-26 03:19 UTC · original
Thanks, @sharan104, for pointing out the device-removal path. I picked up your suggestion in #63 at
33439c8. I put the request in the failure callback after the crash log is written and beforeTerminateProcess. The existing background writer gets up to 250 ms to finish, so a slow disk or a busy writer cannot hold up termination indefinitely.On Linux, an independent reader recovered the final two synthetic pipelines and their shaders after immediate process exit in 20/20 runs. I also held the book lock on the failing thread and separately stalled an in-flight append. The new hook returned in about 250 ms in both cases. The Windows target compiles; actual device removal still needs a Windows run. I credited the suggestion in the PR.
Pull request closed