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

Open
upipibi wants to merge 1 commit from upstream-pr/4704 into main
upipibi commented 2026-12-01 02:35:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by upipibi on 2026-12-01T02:35:15Z.


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 (+ #4619, 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 #4206).
  • 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 #4619.

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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5577795190 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4704). Originally posted by [upipibi](https://github.com/upipibi) on 2026-12-01T02:35:15Z. --- ## 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 (+ #4619, 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 #4206). - `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 #4619. *Tested with the help of Claude Code (Claude Opus 5.5).*
Dukestar69 commented 2026-12-01 12:06:02 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-12-01T12:06:02Z.

Review: APPROVED


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6130936742 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4704#pullrequestreview-6130936742). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-12-01T12:06:02Z. **Review:** APPROVED --- 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).
Tan7rex commented 2026-12-01 15:51:19 +00:00 (Migrated from github.com)

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


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 (#4619'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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7316621329 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4704#issuecomment-7316621329). Originally posted by [Tan7rex](https://github.com/Tan7rex) on 2026-12-01T15:51:19Z. --- 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` (#4619'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 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/4704:upstream-pr/4704'
git switch 'upstream-pr/4704'

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/4704'
git switch 'upstream-pr/4704'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/4704'
git switch 'upstream-pr/4704'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/4704'
git switch 'main'
git merge --squash 'upstream-pr/4704'
git switch 'main'
git merge --ff-only 'upstream-pr/4704'
git switch 'main'
git merge 'upstream-pr/4704'
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!4704
No description provided.