loader,pipeline(cache): coalesce concurrent cache misses and handle publish rename races #92
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/92"
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?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T09:23:26Z.
Summary
Adapted from upstream
VIctory-NVIDIA(86d5539aand78c71e5c, GPL-3.0), extracted cleanly onorigin/main(5d40f8b) with zero overlap against any open PR:crates/victory-pipeline/src/cache.rs): Adds a lightweightFlight/gates(Weak<Mutex<()>>) registry keyed by canonicalized output path so concurrent identical misses inCache::get_or_convert()share one conversion, re-checkpath.is_file()after acquiring the gate, and clean up dead registry entries atomically inDropwhile cache hits remain lock-free.crates/victory-loader/src/publish.rs,crates/victory-pipeline/src/cache.rs): Extractspublish_staging()so Windows rename races against another publisher succeed when expected output exists (destination.is_file()in cache, exact matching bytes in loader publication) without masking unrelated rename errors, preserving PR #83's concurrent publication behavior.Verification
cargo xtask policy:asset policy: 303 files okcargo test -p victory-pipeline -p victory-loader --lib --locked:victory-loader: 52 passed; 0 failed (including 3 newpublish::tests::*rename-race tests)victory-pipeline: 13 passed; 0 failed (includingconcurrent_identical_misses_share_one_conversion,independent_keys_do_not_share_a_gate_and_registry_drains,failed_conversion_releases_gate_for_retry,rename_race_returns_the_other_publishers_file,failed_rename_without_a_destination_returns_the_error, and existingaccepts_entry_published_concurrently_while_open)cargo clippy --workspace --all-targets --locked -- -D warnings: 0 warningscargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings: 0 warningsImported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T10:02:59Z.
Automated triage for the maintainers (not an approval).
Verdict:
merge-candidate· CI (check):passingReview Summary
Clean, well-scoped change with passing CI and thorough unit tests covering both concurrency and rename-race paths.
Verified Changes
crates/victory-loader/src/publish.rs(write_if_changed,publish_staging):publish_staging()so a rename failure (e.g., WindowsPermissionDenied/ sharing violation when a concurrent publisher wins the race) removes the staging file and succeeds only ifdestinationalready contains the exact expectedbytes; otherwise the original rename error is propagated.rename_race_accepts_destination_with_expected_bytes,rename_race_rejects_unexpected_destination_bytes,failed_rename_without_destination_returns_the_error).crates/victory-pipeline/src/cache.rs(Flight,gates,Cache::get_or_convert,Cache::publish,publish_staging):OnceLock<Mutex<HashMap<PathBuf, Weak<Mutex<()>>>>>registry keyed by canonicalized root + relative cache key path (gate_path) so concurrent misses for the same key coalesce into a single conversion while cache hits remain lock-free and the returnedpathis unchanged.gates()is never held across conversion/I/O or while acquiring a per-keyGate, andFlight::dropdropsself.gatewhile holdinggates()sostrong_count() == 0cleanup cannot race with another final drop orWeak::upgrade. Mutex poisoning is handled viaunwrap_or_else(|e| e.into_inner())so a panicked converter does not wedge waiters.publish_staging()preservingdestination.is_file()race acceptance for content-addressed cache entries without masking unrelated rename errors.concurrent_identical_misses_share_one_conversion,independent_keys_do_not_share_a_gate_and_registry_drains,failed_conversion_releases_gate_for_retry,rename_race_returns_the_other_publishers_file,failed_rename_without_a_destination_returns_the_error).Verdict
merge-candidate— logic, concurrency/drop semantics, and tests look solid, CI is passing, no overlap with other open PRs, and no GPU-specific paths are touched. (Automated triage review; not a formal maintainer approval.)Generated with Antigravity CLI (
agy).