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

Open
upipibi wants to merge 1 commit from upstream-pr/4619 into main
upipibi commented 2026-11-30 23:56:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by upipibi on 2026-11-30T23:56:40Z.


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 #4247 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 #4247 report the flake; no open pull request changes either test.

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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5575997493 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4619). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-30T23:56:40Z. --- ## 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 #4247 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 #4247 report the flake; no open pull request changes either test. *Tested with the help of Claude Code (Claude Opus 5.5).*
tyr0nsur commented 2026-12-01 00:15:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-12-01T00:15:57Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7296129827 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4619#issuecomment-7296129827). Originally posted by [tyr0nsur](https://github.com/tyr0nsur) on 2026-12-01T00:15:57Z. --- The same `unwatched.is_none()` assertion failed in the Windows [`check` job for #4339](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.
Tan7rex commented 2026-12-01 15:51:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Tan7rex on 2026-12-01T15:51:17Z.


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 #4704's, so its 0 here may be chance.)

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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7316620482 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4619#issuecomment-7316620482). Originally posted by [Tan7rex](https://github.com/Tan7rex) on 2026-12-01T15:51:17Z. --- 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 #4704's, so its 0 here may be chance.) Not tested: the game (test-only change).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/4619:upstream-pr/4619'
git switch 'upstream-pr/4619'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/4619'
git switch 'upstream-pr/4619'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/4619'
git switch 'upstream-pr/4619'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/4619'
git switch 'main'
git merge --squash 'upstream-pr/4619'
git switch 'main'
git merge --ff-only 'upstream-pr/4619'
git switch 'main'
git merge 'upstream-pr/4619'
git push origin 'main'
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
trustno1-coder/VIctory-NVIDIA!4619
No description provided.