watch: hold one_view_test in the two tests that end the asking #4620

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

@⁠upipibi on GitHub · 2026-11-30 23:56 UTC · original
upipibi:fix-watch-test-lock → main · +7 −0 · 1 files · 1 commits · open

What it changes

watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour fails now and then in a parallel watch:: run and passes on its own (seen in #4027 and #4248 too). The cause is the test, not the code it checks.

The asking that stands (Journal::ahead, kept) is global. The test calls ask_rest, then reads it back with asked, and it doesn't take one_view_test(), the lock that the_rest_of_the_one_asking_has_a_number_of_its_own and the other asking tests hold. Another test's ask_once_end() between those two calls clears ahead, and asked returns None. The result is watched piece touching unwatched neighbour was not cached (watch.rs:5306), or once unwatched.is_none().

an_asking_begun_first_is_made_and_more_is_asked_for also ends the asking and held no lock, so it could clear the asking under a test that holds it. Both now take one_view_test(). No other code changes.

In the layer itself, ask_once, ask_rest and ask_once_end are only called from the submission thread (host.rs), so this is not a race in shipping code.

How it was tested

CPU only, Ryzen 9 5950X (16 cores), Windows 11, cargo test -p victory-gpu --lib --locked -- watch::, default parallel test threads:

tree runs this test failed
main e15366e2 (same test code as 7d93ee07) 40 6 (5× not cached, 1× unwatched.is_none())
main again, interleaved with the next row 20 2
this branch (7d93ee07 + the change) 60 0
  • Negative control: with this branch, disabling the per-piece fallback in ask_rest (if false && covered_to < b && …) makes the test fail 3 of 3 runs, so holding the lock doesn't make it pass on its own.
  • Unrelated: in the 60 runs of this branch, many_askers_tests::no_mapping_is_lost_between_askers failed once, at assert!(super::published(at, end)) (watch.rs:7134). That test already holds the lock and is about placeholder bits, which this doesn't touch. It didn't fail in the 60 runs of main; one in 120 isn't enough to say more.
  • cargo test passed for the crates it touches: watch::, yes (69 passed). Full victory-gpu suite not run.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #4027 and #4248 report the flake; no open pull request changes either test.

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

**@⁠upipibi** on GitHub · 2026-11-30 23:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4619) `upipibi:fix-watch-test-lock` → `main` · +7 −0 · 1 files · 1 commits · open ## What it changes `watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour` fails now and then in a parallel `watch::` run and passes on its own (seen in #4027 and #4248 too). The cause is the test, not the code it checks. The asking that stands (`Journal::ahead`, `kept`) is global. The test calls `ask_rest`, then reads it back with `asked`, and it doesn't take `one_view_test()`, the lock that `the_rest_of_the_one_asking_has_a_number_of_its_own` and the other asking tests hold. Another test's `ask_once_end()` between those two calls clears `ahead`, and `asked` returns `None`. The result is `watched piece touching unwatched neighbour was not cached` (watch.rs:5306), or once `unwatched.is_none()`. `an_asking_begun_first_is_made_and_more_is_asked_for` also ends the asking and held no lock, so it could clear the asking under a test that holds it. Both now take `one_view_test()`. No other code changes. In the layer itself, `ask_once`, `ask_rest` and `ask_once_end` are only called from the submission thread (host.rs), so this is not a race in shipping code. ## How it was tested CPU only, Ryzen 9 5950X (16 cores), Windows 11, `cargo test -p victory-gpu --lib --locked -- watch::`, default parallel test threads: | tree | runs | this test failed | |---|---|---| | main e15366e2 (same test code as 7d93ee07) | 40 | 6 (5× not cached, 1× `unwatched.is_none()`) | | main again, interleaved with the next row | 20 | 2 | | this branch (7d93ee07 + the change) | 60 | 0 | - **Negative control:** with this branch, disabling the per-piece fallback in `ask_rest` (`if false && covered_to < b && …`) makes the test fail 3 of 3 runs, so holding the lock doesn't make it pass on its own. - **Unrelated:** in the 60 runs of this branch, `many_askers_tests::no_mapping_is_lost_between_askers` failed once, at `assert!(super::published(at, end))` (watch.rs:7134). That test already holds the lock and is about placeholder bits, which this doesn't touch. It didn't fail in the 60 runs of main; one in 120 isn't enough to say more. - `cargo test` passed for the crates it touches: `watch::`, yes (69 passed). Full `victory-gpu` suite not run. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4027 and #4248 report the flake; no open pull request changes either test. *Tested with the help of Claude Code (Claude Opus 5.5).*
ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour reads the
asking that stands (Journal::ahead) between ask_rest and asked without the
lock that serializes such tests, so a parallel test's ask_once_end could
clear it in between. 6 of 40 runs of `watch::` failed there on main;
0 of 60 with this. an_asking_begun_first_is_made_and_more_is_asked_for
ends the asking too and held no lock either.

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

@⁠tyr0nsur on GitHub · 2026-12-01 00:15 UTC · original

The same unwatched.is_none() assertion failed in the Windows check job for #4340 on 7d93ee07 plus the texture-sweep change. It matches the second failure mode in the before runs above.

**@⁠tyr0nsur** on GitHub · 2026-12-01 00:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4619#issuecomment-7296129827) The same `unwatched.is_none()` assertion failed in the Windows [`check` job for #4340](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46540898317/job/142278971174) on `7d93ee07` plus the texture-sweep change. It matches the second failure mode in the before runs above.
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 (e9a6e9f0) 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::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour 18 0
watch::tests::a_late_fault_leaves_the_guard_taken_since 2 0
watch::many_askers_tests::no_mapping_is_lost_between_askers 1 0

With this PR, none of the 500 runs had any failure. (a_late_fault_leaves_the_guard_taken_since is #4705's, so its 0 here may be chance.)

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/4619#issuecomment-7316620482) Tested on Windows 11 Pro (build 26100), RTX 4090: this PR's change (e9a6e9f0) 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::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour` | 18 | **0** | | `watch::tests::a_late_fault_leaves_the_guard_taken_since` | 2 | 0 | | `watch::many_askers_tests::no_mapping_is_lost_between_askers` | 1 | 0 | With this PR, none of the 500 runs had any failure. (`a_late_fault_leaves_the_guard_taken_since` is #4705's, so its 0 here may be chance.) 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/4620/head:github-bot/gh-4619'
git switch 'github-bot/gh-4619'

Merge

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