watch tests: forget the views before the addresses go back (38 failing runs in 300 of the watch tests, 0 in 600 after) #963

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

@⁠MamaLeVrai on GitHub · 2026-11-25 13:52 UTC · original
MamaLeVrai:watch-test-forget-first → main · +8 −3 · 1 files · 1 commits · open

Tests in watch.rs fail now and then when the tests of the binary run side by side (the default). On main (0b0074e), RX 6950 XT (RDNA2), Windows 11 build 26300, Rust 1.98.1, running only the watch:: tests of the victory_gpu test binary (victory_gpu-….exe watch::), 300 runs: 38 failed (13 kernel_reads_into_guarded_blocks_after_opening, 12 a_write_told_at_one_view_is_reported_at_the_others, 9 a_write_through_another_view_is_reported_at_the_guarded_one, 5 writes_in_partly_committed_view_blocks_are_reported, 1 a_write_is_reported_at_every_checked_view). With --test-threads=1: 0 of 200. In whole-binary runs (with #849 and #878 merged so those two do not hide them) 3 of 200 runs failed on a watch:: test.

The assertions that fail show pages missing or reported again, for example left: [] right: [26709552, 26709553, 26709554], left: Some([29889239, 29889240]) right: Some([]) ("nothing written yet") and left: Some([34624605, 34624606]) right: Some([34624606]).

The change. Three tests (kernel_reads_into_guarded_blocks_after_opening and the two placeholder tests) gave their addresses back (UnmapViewOfFile, VirtualFree) and only then told the guards with title_memory_remapped; the runtime does it the other way round, and the other tests of the module already do (drop_views, View::drop). They now call it first. Only tests change.

What I did not see. I did not catch the interleaving itself. My reading is that a test beside these can map its own view at the address just given back, and the late call then clears the guards it has set there (protected, clean, absent, viewed are by block address). The numbers say the order is the cause: the same 300-run loop went from 38 failing runs to 0 in 600 runs with the change.

Not covered. The whole victory_gpu binary still ends in a driver crash now and then on this machine, about 1 run in 10 (no test named; the Windows event log shows amdxc64.dll or d3d10warp.dll as the faulting module); this PR does not touch that.

harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

**@⁠MamaLeVrai** on GitHub · 2026-11-25 13:52 UTC · [original](https://github.com/fxceless/victory-fork/pull/963) `MamaLeVrai:watch-test-forget-first` → `main` · +8 −3 · 1 files · 1 commits · open Tests in `watch.rs` fail now and then when the tests of the binary run side by side (the default). On `main` (`0b0074e`), RX 6950 XT (RDNA2), Windows 11 build 26300, Rust 1.98.1, running only the `watch::` tests of the `victory_gpu` test binary (`victory_gpu-….exe watch::`), 300 runs: **38 failed** (13 `kernel_reads_into_guarded_blocks_after_opening`, 12 `a_write_told_at_one_view_is_reported_at_the_others`, 9 `a_write_through_another_view_is_reported_at_the_guarded_one`, 5 `writes_in_partly_committed_view_blocks_are_reported`, 1 `a_write_is_reported_at_every_checked_view`). With `--test-threads=1`: 0 of 200. In whole-binary runs (with #849 and #878 merged so those two do not hide them) 3 of 200 runs failed on a `watch::` test. The assertions that fail show pages missing or reported again, for example `left: [] right: [26709552, 26709553, 26709554]`, `left: Some([29889239, 29889240]) right: Some([])` ("nothing written yet") and `left: Some([34624605, 34624606]) right: Some([34624606])`. **The change.** Three tests (`kernel_reads_into_guarded_blocks_after_opening` and the two placeholder tests) gave their addresses back (`UnmapViewOfFile`, `VirtualFree`) and only then told the guards with `title_memory_remapped`; the runtime does it the other way round, and the other tests of the module already do (`drop_views`, `View::drop`). They now call it first. Only tests change. **What I did not see.** I did not catch the interleaving itself. My reading is that a test beside these can map its own view at the address just given back, and the late call then clears the guards it has set there (`protected`, `clean`, `absent`, `viewed` are by block address). The numbers say the order is the cause: the same 300-run loop went from 38 failing runs to 0 in 600 runs with the change. **Not covered.** The whole `victory_gpu` binary still ends in a driver crash now and then on this machine, about 1 run in 10 (no test named; the Windows event log shows `amdxc64.dll` or `d3d10warp.dll` as the faulting module); this PR does not touch that. harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300 AI-assisted (Claude Code); no game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:54:44 +00:00
Author
Owner

@⁠cmt8 on GitHub · 2026-11-25 15:58 UTC · original

The same reorder, under Wine, confirms it here. We made the identical change to these three tests on our Linux branch (cmt8/VIctory afe67caa), after kernel_reads_into_guarded_blocks_after_opening failed once in 43 runs of the watch tests under Wine. With half of the change, 1 run in 70 still failed. With all of it, 0 runs in 30 failed. #769 is the same change as well.

One more watch flake remains with this PR applied: written_pages_are_reported_to_every_asker failing with before.is_empty(). That one is the journal, not the guards. drop_views tells title_memory_remapped but leaves the views' pages in the journal's written map, so the next test to get that address finds them written. Over 200 runs each of the victory-gpu binary under Wine 11.22 (RX 7900 XTX):

Build Failed runs
0b0074e0 3
0b0074e0 + this PR 2 (both written_pages_..., before.is_empty())
0b0074e0 + this PR + dropping the journal's pages in drop_views 0

The counts are small. The journal change is test-only and is in a separate PR (#1008) so it does not get in the way of this one.

AI-assisted (Claude Code); no game data.

**@⁠cmt8** on GitHub · 2026-11-25 15:58 UTC · [original](https://github.com/fxceless/victory-fork/pull/963#issuecomment-7167479782) The same reorder, under Wine, confirms it here. We made the identical change to these three tests on our Linux branch (cmt8/VIctory afe67caa), after `kernel_reads_into_guarded_blocks_after_opening` failed once in 43 runs of the watch tests under Wine. With half of the change, 1 run in 70 still failed. With all of it, 0 runs in 30 failed. #769 is the same change as well. One more watch flake remains with this PR applied: `written_pages_are_reported_to_every_asker` failing with `before.is_empty()`. That one is the journal, not the guards. `drop_views` tells `title_memory_remapped` but leaves the views' pages in the journal's `written` map, so the next test to get that address finds them written. Over 200 runs each of the victory-gpu binary under Wine 11.22 (RX 7900 XTX): | Build | Failed runs | |---|---:| | `0b0074e0` | 3 | | `0b0074e0` + this PR | 2 (both `written_pages_..., before.is_empty()`) | | `0b0074e0` + this PR + dropping the journal's pages in `drop_views` | 0 | The counts are small. The journal change is test-only and is in a separate PR (#1008) so it does not get in the way of this one. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠welisonzika14-jpg on GitHub · 2026-11-25 16:04 UTC · original

Machine: RTX 5070, driver 621.24, Windows 11, Rust 1.98.1 (MSVC).
Command: build the victory-gpu tests, then run the test binary watch:: 50 times (default threads), counting runs with a failure.

  • fx/main 3973179: 2 of 50 runs failed: writes_in_partly_committed_view_blocks_are_reported 1, unmapped_blocks_are_reported_once_until_mapped 1.
  • fx/main + #963 (2009b95, merged, ee22311): 0 of 50 runs failed.

Small sample (50 runs, one machine); 0/50 does not prove the flake is gone. The failure messages of the two failures were not captured.

Written with AI help (Claude/Kiro); the numbers are from runs on my machine.

**@⁠welisonzika14-jpg** on GitHub · 2026-11-25 16:04 UTC · [original](https://github.com/fxceless/victory-fork/pull/963#issuecomment-7167570421) Machine: RTX 5070, driver 621.24, Windows 11, Rust 1.98.1 (MSVC). Command: build the victory-gpu tests, then run the test binary `watch::` 50 times (default threads), counting runs with a failure. - fx/main 3973179: 2 of 50 runs failed: writes_in_partly_committed_view_blocks_are_reported 1, unmapped_blocks_are_reported_once_until_mapped 1. - fx/main + #963 (2009b95, merged, ee22311): 0 of 50 runs failed. Small sample (50 runs, one machine); 0/50 does not prove the flake is gone. The failure messages of the two failures were not captured. Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 23:36 UTC · original

Thank you both. cmt8: good that the same reorder holds under Wine, and thanks for splitting the journal part into #1008; I saw written_pages_are_reported_to_every_asker fail once in 150 runs of another tree here too, so that one is worth its own fix. welisonzika14-jpg: 2 in 50 on main and 0 in 50 with the change is in line with the 38 in 300 and 0 in 600 I measured.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 23:36 UTC · [original](https://github.com/fxceless/victory-fork/pull/963#issuecomment-7177807839) Thank you both. cmt8: good that the same reorder holds under Wine, and thanks for splitting the journal part into #1008; I saw `written_pages_are_reported_to_every_asker` fail once in 150 runs of another tree here too, so that one is worth its own fix. welisonzika14-jpg: 2 in 50 on `main` and 0 in 50 with the change is in line with the 38 in 300 and 0 in 600 I measured. AI-assisted (Claude Code); no game data.
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/963/head:github-bot/gh-963'
git switch 'github-bot/gh-963'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-963'
git switch 'github-bot/gh-963'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-963'
git switch 'github-bot/gh-963'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-963'
git switch 'main'
git merge --squash 'github-bot/gh-963'
git switch 'main'
git merge --ff-only 'github-bot/gh-963'
git switch 'main'
git merge 'github-bot/gh-963'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.