watch: a_late_fault_leaves_the_guard_taken_since holds the guards' lock while its entry is unsettled #4705

Open
github-bot wants to merge 1 commit from github-bot/gh-4704 into main AGit
Owner

@⁠upipibi on GitHub · 2026-12-01 02:35 UTC · original
upipibi:fix-late-fault-test → main · +7 −1 · 1 files · 1 commits · open

What it changes

watch::tests::a_late_fault_leaves_the_guard_taken_since fails now and then when the whole victory-gpu suite runs in parallel and passes on its own. #3920, #3474 and #3723 each report it that way. The cause is the test, not the code it checks.

The test pushes an Opened entry onto the global OPENED queue and then asserts that both blocks are unsettled. But any thread that takes guards() runs settle first, so another test's thread taking the guards' lock between the push and the assertion settles the entry: assertion failed: unsettled(block(one), block(one) + 1). It also didn't take one_view_test(), though it maps views of its own.

Now it takes one_view_test(), and holds guards() from before the push until those three assertions. The next block, which takes guards() to settle the entry, is unchanged; whoever settles it, the assertions that follow hold the same. Only the test changes.

How it was tested

CPU only: Ryzen 9 5950X (16 cores), Windows 11, cargo test -p victory-gpu --lib --locked, the whole library suite with default parallel threads, 20 runs each:

tree this test failed
main 7d93ee07 (+ #4620, which touches two other tests) 8 of 20
this branch (main f5c3d243 + the change) 0 of 20

The two mains differ by two commits, neither in watch.rs, host.rs or shadow.rs.

Other failures in those runs, not touched here:

  • host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue: 5 and 7 of 20 runs (also seen in #4207).
  • host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end: once, on this branch.

cargo test passed for the crates it touches: yes, apart from the flakes above.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3920, #3474 and #3723 report the flake; no open pull request changes this test. Same kind of fix as #4620.

Tested with the help of Claude Code (Claude Opus 5.5).

**@⁠upipibi** on GitHub · 2026-12-01 02:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4704) `upipibi:fix-late-fault-test` → `main` · +7 −1 · 1 files · 1 commits · open ## What it changes `watch::tests::a_late_fault_leaves_the_guard_taken_since` fails now and then when the whole `victory-gpu` suite runs in parallel and passes on its own. #3920, #3474 and #3723 each report it that way. The cause is the test, not the code it checks. The test pushes an `Opened` entry onto the global `OPENED` queue and then asserts that both blocks are unsettled. But any thread that takes `guards()` runs `settle` first, so another test's thread taking the guards' lock between the push and the assertion settles the entry: `assertion failed: unsettled(block(one), block(one) + 1)`. It also didn't take `one_view_test()`, though it maps views of its own. Now it takes `one_view_test()`, and holds `guards()` from before the push until those three assertions. The next block, which takes `guards()` to settle the entry, is unchanged; whoever settles it, the assertions that follow hold the same. Only the test changes. ## How it was tested CPU only: Ryzen 9 5950X (16 cores), Windows 11, `cargo test -p victory-gpu --lib --locked`, the whole library suite with default parallel threads, 20 runs each: | tree | this test failed | |---|---| | main 7d93ee07 (+ #4620, which touches two other tests) | 8 of 20 | | this branch (main f5c3d243 + the change) | 0 of 20 | The two mains differ by two commits, neither in `watch.rs`, `host.rs` or `shadow.rs`. Other failures in those runs, not touched here: - `host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue`: 5 and 7 of 20 runs (also seen in #4207). - `host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end`: once, on this branch. `cargo test` passed for the crates it touches: yes, apart from the flakes above. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3920, #3474 and #3723 report the flake; no open pull request changes this test. Same kind of fix as #4620. *Tested with the help of Claude Code (Claude Opus 5.5).*
The test queues an Opened entry and then asserts the blocks are
unsettled, but any thread that takes the guards' lock settles the queue
first: in a parallel run of the whole victory-gpu suite another test's
thread did so between the push and the assertion (watch.rs, the first
`unsettled(block(one))` assertion). It now holds `guards()` from the
push until those assertions and takes `one_view_test()`, as tests that
map views of their own do. Whole suite in parallel: 8 of 20 runs failed
there before, 0 of 20 after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 02:36:11 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-12-01 12:06 UTC · original · approved these changes

Reviewed crates/victory-gpu/src/watch.rs: taking one_view_test() and holding guards() across the unsettled-entry check in _late_fault_leaves_the_guard_taken_since prevents concurrent tests from settling the queue before the assertion runs. Verified on Windows: cargo test -p victory-gpu --lib watch::tests::a_late_fault_leaves_the_guard_taken_since -- --test-threads=1 (1 passed, 0 failed).

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-12-01 12:06 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4704#pullrequestreview-6130936742) · **approved these changes** Reviewed crates/victory-gpu/src/watch.rs: taking one_view_test() and holding guards() across the unsettled-entry check in _late_fault_leaves_the_guard_taken_since prevents concurrent tests from settling the queue before the assertion runs. Verified on Windows: cargo test -p victory-gpu --lib watch::tests::a_late_fault_leaves_the_guard_taken_since -- --test-threads=1 (1 passed, 0 failed). Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠Tan7rex on GitHub · 2026-12-01 15:51 UTC · original

Tested on Windows 11 Pro (build 26100), RTX 4090: this PR's change (e03346cc) applied onto main 5fabb46e (it applies cleanly). Release test binary of victory-gpu --lib, watch:: filter, 500 runs each with default parallel threads.

Test, runs failed out of 500 main 5fabb46e main + this PR
watch::tests::a_late_fault_leaves_the_guard_taken_since 2 0
watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour (#4620's) 18 12
watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock 0 1

The test this PR fixes failed only 2 times in 500 on main here, so 0 with the PR fits the fix but doesn't prove it. In 60 runs of the whole victory-gpu library on main it failed once. The one no_write_is_lost_when_faults_take_no_lock failure looks unrelated: this PR only changes a_late_fault_leaves_the_guard_taken_since, and that test also failed once in 300 runs with #3603 applied.

Not tested: the game (test-only change).

**@⁠Tan7rex** on GitHub · 2026-12-01 15:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4704#issuecomment-7316621329) Tested on Windows 11 Pro (build 26100), RTX 4090: this PR's change (e03346cc) applied onto `main` 5fabb46e (it applies cleanly). Release test binary of `victory-gpu --lib`, `watch::` filter, 500 runs each with default parallel threads. | Test, runs failed out of 500 | `main` 5fabb46e | `main` + this PR | |---|---|---| | `watch::tests::a_late_fault_leaves_the_guard_taken_since` | 2 | 0 | | `watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour` (#4620's) | 18 | 12 | | `watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock` | 0 | 1 | The test this PR fixes failed only 2 times in 500 on `main` here, so 0 with the PR fits the fix but doesn't prove it. In 60 runs of the whole `victory-gpu` library on `main` it failed once. The one `no_write_is_lost_when_faults_take_no_lock` failure looks unrelated: this PR only changes `a_late_fault_leaves_the_guard_taken_since`, and that test also failed once in 300 runs with #3603 applied. Not tested: the game (test-only change).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4705/head:github-bot/gh-4704'
git switch 'github-bot/gh-4704'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4704'
git switch 'github-bot/gh-4704'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4704'
git switch 'github-bot/gh-4704'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4704'
git switch 'main'
git merge --squash 'github-bot/gh-4704'
git switch 'main'
git merge --ff-only 'github-bot/gh-4704'
git switch 'main'
git merge 'github-bot/gh-4704'
git push origin 'main'
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!4705
No description provided.