Shader cache: an entry another thread published meanwhile is taken (port of Marvisak#1324) #664

Manually merged
github merged 1 commit from github-bot/gh-664 into main 2026-11-29 00:28:15 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 03:02 UTC · original
kibagami-nc:fix/shader-cache-concurrent-publish → main · +65 −3 · 1 files · 1 commits · merged 2026-11-29 00:24 UTC

The problem

Cache::get_or_convert (crates/victory-pipeline/src/cache.rs) is the shader cache's store (victory-gpu/src/shader_cache.rs). It writes a translation to a staging file and renames it over the content-addressed entry.

Sometimes another thread or process (the pipeline makers, or victory warm's processes) has finished publishing the same entry in the meantime and still holds it open. Windows then refuses the rename, with access denied or a sharing violation.

That error came back as the translation's. shader_cache::host_shader passes it on, so the shader was taken as one that does not translate, and its pipelines' draws were dropped for the run.

The change

If the rename fails, the staging file is removed. When the entry is now there, it is taken. When it is not there, or is not a file, the error is still given. A write that fails before the rename is still an error, as before.

This is a port of mgunes1311-lab's fix (Marvisak/VIctory#1324). It applied cleanly.

Tests

  • New cache::tests::accepts_entry_published_concurrently_while_open, which comes with the port. During the conversion, the test publishes the same entry and holds it open in read share mode, so the rename is refused. Before the change it fails with Access denied (os error 5).
  • cargo test -p victory-pipeline --locked: 8 passed. That includes failed_publication_removes_the_staging_file, which still passes.
  • cargo clippy -p victory-pipeline --all-targets -- -D warnings: no warnings.

No game files, dumps or extracted data are included.

**@⁠kibagami-nc** on GitHub · 2026-11-28 03:02 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/664) `kibagami-nc:fix/shader-cache-concurrent-publish` → `main` · +65 −3 · 1 files · 1 commits · merged 2026-11-29 00:24 UTC ## The problem `Cache::get_or_convert` (`crates/victory-pipeline/src/cache.rs`) is the shader cache's store (`victory-gpu/src/shader_cache.rs`). It writes a translation to a staging file and renames it over the content-addressed entry. Sometimes another thread or process (the pipeline makers, or `victory warm`'s processes) has finished publishing the same entry in the meantime and still holds it open. Windows then refuses the rename, with access denied or a sharing violation. That error came back as the translation's. `shader_cache::host_shader` passes it on, so the shader was taken as one that does not translate, and its pipelines' draws were dropped for the run. ## The change If the rename fails, the staging file is removed. When the entry is now there, it is taken. When it is not there, or is not a file, the error is still given. A write that fails before the rename is still an error, as before. This is a port of mgunes1311-lab's fix ([Marvisak/VIctory#1324](https://github.com/Marvisak/VIctory/pull/1324)). It applied cleanly. ## Tests - New `cache::tests::accepts_entry_published_concurrently_while_open`, which comes with the port. During the conversion, the test publishes the same entry and holds it open in read share mode, so the rename is refused. Before the change it fails with `Access denied (os error 5)`. - `cargo test -p victory-pipeline --locked`: 8 passed. That includes `failed_publication_removes_the_staging_file`, which still passes. - `cargo clippy -p victory-pipeline --all-targets -- -D warnings`: no warnings. No game files, dumps or extracted data are included.
get_or_convert writes a translation to a staging file and renames it over
the content-addressed entry. When another thread or process (the pipeline
makers, victory warm's processes) finished publishing the same entry in the
meantime and held it open, Windows refused the rename (access denied or a
sharing violation), and the error came back as the translation's: the
shader cache's caller then took the shader as one that does not translate,
and its pipelines' draws were dropped for the run.

The staging file is removed, and the entry is taken when it is there now;
the error is still given when it is not (or is not a file). A write that
fails before the rename is still an error.

Port of mgunes1311-lab's fix (Marvisak/VIctory#1324), with its test
accepts_entry_published_concurrently_while_open: during the conversion the
same entry is published and held open (share mode read), so the rename is
refused. It fails before the change with "access denied" (os error 5).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 03:07:39 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 05:35 UTC · original · approved these changes

LGTM — verified on Windows:

  • cargo test -p victory-pipeline passed (8/8, including accepts_entry_published_concurrently_while_open)
  • cargo clippy -p victory-pipeline --all-targets -- -D warnings passed with 0 warnings
  • cargo xtask policy passed (294 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 05:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/664#pullrequestreview-6096069225) · **approved these changes** LGTM — verified on Windows: - `cargo test -p victory-pipeline` passed (8/8, including `accepts_entry_published_concurrently_while_open`) - `cargo clippy -p victory-pipeline --all-targets -- -D warnings` passed with 0 warnings - `cargo xtask policy` passed (`294 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github-bot referenced this pull request from a commit 2026-11-29 00:27:22 +00:00
github manually merged commit 701dcbc9b0 into main 2026-11-29 00:28:15 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!664
No description provided.