Handle loader publication rename races #1539
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1539"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by Gauss999 on 2026-11-28T21:23:43Z.
Summary
mainnow contains the cache-side race handling and its Windows regression test. That file was adopted unchanged, leaving this PR scoped tocrates/victory-loader/src/publish.rs.Tests
victory-loaderandvictory-pipelinewith and without all features, and the reported library test runs passed 49 + 9 tests.db24ab7. CI is awaiting maintainer approval.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-28T22:03:30Z.
Built and tested this on Windows, since it hadn't been run yet: Windows 11, Rust 1.98.1 (pinned), applied on current
main(d4b5d51); both commits cherry-pick cleanly.cargo clippy -p victory-loader -p victory-pipeline --all-targets --locked -- -D warnings, with and without--all-features: passcargo test -p victory-loader -p victory-pipeline --lib --locked: 49 + 9 passed, 5 of 5 runsxtask policyfails only onlower.rs's size, which is already onmain(#1429)The race is real on Windows, and this fixes it. I stressed
Cache::get_or_convertfrom a throwaway integration test (not part of this PR): 300 rounds, each with 16 threads publishing the same new entry at once while 4 threads open the destination withshare_mode(FILE_SHARE_READ)(noFILE_SHARE_DELETE, as a scanner or a mapping reader would) and hold it for 200 µs. Each round also checks that no staging file is left and that the published bytes are right.main, run 1Access is denied. (os error 5)main, run 2With readers using
std::fs::read(which shares delete),mainhad no failures either (0 of 14,400), so the failure needs a reader that doesn't share delete. No staging files were left on either side, and the published bytes were right every round.The loader's
write_if_changedispub(crate), so I only covered it through this PR's unit tests, not the stress.One design note, not a blocker: the cache accepts any regular file at the destination after a failed rename, while the loader requires its exact bytes. That seems right given the key is a content hash; the PR says readers validate on decode, which I didn't check. Happy to share the stress test if it's useful.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-29T08:28:15Z.
Thank you! An earlier version of this pull request was merged into main with its original commits and is part of v2026.11.29.01, where you are credited. GitHub does not show it as merged because new commits were pushed here after that merge. It stays open so those newer commits can be looked at next.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Gauss999 on 2026-11-29T18:34:09Z.
Closing this after auditing the current heads: there is no residual behaviour left in this PR. The diff of crates/victory-loader/src/publish.rs against the current upstream/main is empty — the original commits are integrated upstream (
0c07d4ac, part of v2026.11.29.01, with authorship credit as noted above), and the branch only carries the merge commitdb24ab7eon top. Nothing further to review here; thanks for keeping the credit intact.Pull request closed