Reuse a completed shader cache entry after a concurrent write #632

Closed
github-bot wants to merge 1 commit from github-bot/gh-632 into main AGit
Owner

@⁠cnuonr on GitHub · 2026-11-28 02:07 UTC · original
cnuonr:fix/shader-cache-concurrent-publish → main · +55 −2 · 1 files · 1 commits · closed without merging

Problem

Two shader translations can miss the same content-addressed cache key. If the first writer publishes the entry and a reader keeps it open on Windows, replacement by the second writer can fail with access denied. The existing complete entry is already available, but the second caller reports a shader conversion error.

Change

After a failed publication, remove the staging file and use the completed entry if a file now exists at the cache key. An unavailable destination still returns the original error.

Verification

cargo test --locked -p victory-pipeline --lib cache::tests passed all 8 tests on Windows. The new test reproduces the access-denied error on the original implementation with a file opened for shared reads. It checks that the final result remains readable and that the staging file is cleaned up.

**@⁠cnuonr** on GitHub · 2026-11-28 02:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/632) `cnuonr:fix/shader-cache-concurrent-publish` → `main` · +55 −2 · 1 files · 1 commits · closed without merging ## Problem Two shader translations can miss the same content-addressed cache key. If the first writer publishes the entry and a reader keeps it open on Windows, replacement by the second writer can fail with access denied. The existing complete entry is already available, but the second caller reports a shader conversion error. ## Change After a failed publication, remove the staging file and use the completed entry if a file now exists at the cache key. An unavailable destination still returns the original error. ## Verification `cargo test --locked -p victory-pipeline --lib cache::tests` passed all 8 tests on Windows. The new test reproduces the access-denied error on the original implementation with a file opened for shared reads. It checks that the final result remains readable and that the staging file is cleaned up.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 02:09:28 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-28 20:28 UTC · original

Thanks for this. I'm closing it because main already does this: when the rename fails because another writer published the same key meanwhile, the existing entry is used (crates/victory-pipeline/src/cache.rs, with its own test of an entry published while open). The two conflict.

**@⁠trustno1-coder** on GitHub · 2026-11-28 20:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/632#issuecomment-7245316596) Thanks for this. I'm closing it because main already does this: when the rename fails because another writer published the same key meanwhile, the existing entry is used (crates/victory-pipeline/src/cache.rs, with its own test of an entry published while open). The two conflict.
github-bot closed this pull request 2026-11-28 20:34:20 +00:00

Pull request closed

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!632
No description provided.