pipeline(cache): accept shader cache entries published concurrently while open #83

Merged
Androtim merged 1 commit from upstream-pr/83 into main 2026-11-29 06:05:53 +00:00
Androtim commented 2026-11-29 05:42:06 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T05:42:06Z.


Summary

Adapted from upstream Marvisak/VIctory#1324 / VIctory-NVIDIA#664 (701dcbc, GPL-3.0), extracted cleanly off origin/main (8d89ba6) with zero overlap against open PRs:

  • Concurrent publish race fix (crates/victory-pipeline/src/cache.rs): When get_or_convert races with another thread/process that publishes and opens the same content-addressed shader cache entry before persist/rename completes (producing Windows access denied / sharing violation), remove our temporary staging file and open the published entry instead of treating the race as an untranslatable shader error and dropping its draws.
  • Test: Adds accepts_entry_published_concurrently_while_open (which reproduces the share-mode-read Windows lock contention).

Verification

  • cargo xtask policy: asset policy: 303 files ok
  • cargo test -p victory-pipeline --locked: 8 passed; 0 failed (including accepts_entry_published_concurrently_while_open)
  • cargo clippy --workspace --all-targets --locked -- -D warnings: 0 warnings
  • cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings: 0 warnings
<!-- greyfinch-sync:Androtim/MiniVI:issue:5547984376 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/83). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T05:42:06Z. --- ## Summary Adapted from upstream `Marvisak/VIctory#1324` / `VIctory-NVIDIA#664` (`701dcbc`, GPL-3.0), extracted cleanly off `origin/main` (`8d89ba6`) with zero overlap against open PRs: - **Concurrent publish race fix (`crates/victory-pipeline/src/cache.rs`):** When `get_or_convert` races with another thread/process that publishes and opens the same content-addressed shader cache entry before `persist`/rename completes (producing Windows access denied / sharing violation), remove our temporary staging file and open the published entry instead of treating the race as an untranslatable shader error and dropping its draws. - **Test:** Adds `accepts_entry_published_concurrently_while_open` (which reproduces the share-mode-read Windows lock contention). ## Verification - `cargo xtask policy`: `asset policy: 303 files ok` - `cargo test -p victory-pipeline --locked`: **8 passed; 0 failed** (including `accepts_entry_published_concurrently_while_open`) - `cargo clippy --workspace --all-targets --locked -- -D warnings`: **0 warnings** - `cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings`: **0 warnings**
Androtim commented 2026-11-29 06:04:03 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T06:04:03Z.


Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Review Summary

  • Correctness (crates/victory-pipeline/src/cache.rs): Cache::get_or_convert separates file.write_all(&output) from std::fs::rename(&tmp, &path) so write failures still fail immediately after cleaning up the staging file, while a failed rename removes the staging file and accepts path if path.is_file() is true. Because CacheKey is content-addressed and entries are only published atomically via temp-file rename, an existing regular file at path is a valid concurrent publication. Non-file collisions (such as a directory at path, covered by failed_publication_removes_the_staging_file) continue to return an error.
  • Test coverage: The new Windows-only test accepts_entry_published_concurrently_while_open holds path open with FILE_SHARE_READ (share_mode(1)), asserts that replacing path via std::fs::rename fails under contention, verifies get_or_convert succeeds with the expected bytes, confirms no staging files remain in the bucket directory, and drops conv before TempDir so cleanup succeeds on Windows.
  • Scope & CI: Small, self-contained fix with no overlap against other open PRs, CI passing, and no GPU/D3D12 behavior changes requiring local hardware testing.

Automated technical triage only — not formal maintainer approval.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7251626307 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/83#issuecomment-7251626307). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T06:04:03Z. --- <!-- minivi-triage v1 head=a4267028bcbc32cc3dd072489f382b04d8ed803c verdict=merge-candidate ci=passing at=2026-11-29T06:04:36Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` ### Review Summary - **Correctness (`crates/victory-pipeline/src/cache.rs`):** `Cache::get_or_convert` separates `file.write_all(&output)` from `std::fs::rename(&tmp, &path)` so write failures still fail immediately after cleaning up the staging file, while a failed `rename` removes the staging file and accepts `path` if `path.is_file()` is true. Because `CacheKey` is content-addressed and entries are only published atomically via temp-file rename, an existing regular file at `path` is a valid concurrent publication. Non-file collisions (such as a directory at `path`, covered by `failed_publication_removes_the_staging_file`) continue to return an error. - **Test coverage:** The new Windows-only test `accepts_entry_published_concurrently_while_open` holds `path` open with `FILE_SHARE_READ` (`share_mode(1)`), asserts that replacing `path` via `std::fs::rename` fails under contention, verifies `get_or_convert` succeeds with the expected bytes, confirms no staging files remain in the bucket directory, and drops `conv` before `TempDir` so cleanup succeeds on Windows. - **Scope & CI:** Small, self-contained fix with no overlap against other open PRs, CI passing, and no GPU/D3D12 behavior changes requiring local hardware testing. *Automated technical triage only — not formal maintainer approval.* --- _Generated with Antigravity CLI (`agy`)._
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
Androtim/MiniVI!83
No description provided.