known.rs flush() takes the batch before writing and never restores it: one failed write permanently drops pipelines the book already counts as known #41
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#41
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@itsonewi on GitHub · 2026-11-25 23:59 UTC · original
The pipeline book takes its batch out of memory before writing it and never puts it back, and nothing flushes it at exit — so a failed write, or a device loss, silently drops pipelines the book has already recorded as known.
Where
crates/victory-gpu/src/pipeline/known.rs:126-146:note()has already put those pipelines into the in-memory dedupe sets before the write is tried (:98:if shaders.is_empty() || !book.keys.insert(id) { return; }), so after a failure the same pipeline is never noted again in this run: the entry is not in the file and will never be offered to it.Why it happens in practice
ERROR_SHARING_VIOLATION(0x20) orERROR_DISK_FULLfromOpenOptions::openorwrite_all. The run continues; the log has onewarnline among thousands.flush()is only ever called by the two-second timer started inbook()(:78-83).BOOKis aOnceLock<Option<Mutex<Book>>>and its contents are never dropped, so the last batch is written only if the process lives another two seconds — andd3d12x::host_gpu_failedends the process withTerminateProcess, which runs no destructors and noatexit. Device removal is the ending most runs in this tracker report, and the busiest pipeline-creation window is right before it.Either way the loss is silent and permanent:
known-pipelines.binis smaller than the run's actual work, so the next run starts fewer pipelines early (the module's own premise is "which ones is known from earlier runs") andvictory warm --used, which lists the file's keys (known::keys,:292), offers fewer of them — which also looks like the "0 to make" symptom of #26 rather than like data loss.Fix
Write first, then clear: on a write error, put
newandaddedback (book.new[i].splice(0..0, …)per file / re-add the count) or keep apendinglist that is only cleared after a successful write; and drop the ids frombook.keys/book.shadersfor the pipelines that were not written, so they are noted again on the next creation. Also flush once on the way out of a normal run (the timer is not an exit path), and accept that aTerminateProcessloss of the last batch is unavoidable — but then the ids must not be remembered, which is the same fix.Not checked
Source reading at
0a43566. I did not reproduce a failedflush()(no build, no Windows run), so the sequence above is read from the code; theTerminateProcessclaim comes fromcrates/victory-hle/src/modules/d3d12x.rs:104-115.AI use
AI-assisted review (source reading). No build, no run, no game files.