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

Merged
kibagami-nc merged 1 commit from upstream-pr/664 into main 2026-11-29 00:24:47 +00:00
kibagami-nc commented 2026-11-28 03:02:05 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T03:02:05Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5536042075 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/664). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T03:02:05Z. --- ## 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.
Dukestar69 commented 2026-11-28 05:35:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T05:35:39Z.

Review: APPROVED


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6096069225 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/664#pullrequestreview-6096069225). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-28T05:35:39Z. **Review:** APPROVED --- 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).
Sign in to join this conversation.
No reviewers
No labels
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.

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