victory-gpu's watch tests fail one or two per full run, never the same ones (concurrency; --test-threads=1 is clean) #4

Open
opened 2026-12-01 21:57:53 +00:00 by github-bot · 2 comments
Owner

@⁠erdemcisse on GitHub · 2026-12-01 21:54 UTC · original

Once the CI step gets past clippy (#3, #2), cargo test --workspace runs for the first time — and victory-gpu's watch tests fail intermittently, one or two per full run, never the same ones:

run A  cargo test -p victory-gpu --lib     457 passed; 0 failed
run B  cargo test -p victory-gpu --lib     455 passed; 2 failed  watch::tests::a_block_just_written_rests
                                                                watch::tests::a_write_is_reported_at_every_checked_view
run C  cargo test -p victory-gpu --lib     456 passed; 1 failed  watch::port7_tests::no_write_is_lost_with_port_7
run D  cargo test -p victory-gpu --lib     457 passed; 0 failed
run E  cargo test -p victory-gpu --lib     457 passed; 0 failed   (with my #3 applied)
run F  cargo test -p victory-gpu --lib     456 passed; 1 failed  watch::port7_tests::no_write_is_lost_with_port_7  (with #3)

cargo test -p victory-gpu --lib -- --test-threads=1     457 passed; 0 failed
cargo test -p victory-gpu --lib watch::tests::          30 passed; 0 failed  (three times in a row, alone)

So it is concurrency, not the diff: single-threaded is clean every time, the failures only appear while other tests run alongside, and they move between runs. The assertions that go are about counts on process-wide state — assertion \left == right` failed: nothing written yetina_block_just_written_rests, and the same shape in a_write_is_reported_at_every_checked_view`.

Two shared things are in the neighbourhood, both in crates/victory-gpu/src/watch.rs:

  • static GUARDS: RwLock<Guards> (line 2502) with guards() taking the write lock (2515), and guards_timed()/guards_timed_shared() taking read ones — every test that calls guard(), writable(), published() or writes() goes through it, and the assertions compare whole bookkeeping answers (Some(vec![page]) / Some(Vec::new())) rather than "the entry for this view".
  • real VirtualAlloc'd MEM_WRITE_WATCH pages (two_views()), whose faults are raised by the installed handler on any thread, plus a process-wide REST_IN_TEST (thread_local!, line 2370) that some tests set to an hour and others read.

My guess — not measured — is that a test's assertions see another test's guards or faults, and that the fix is to scope the assertions to the test's own views, or to hold one test mutex for everything that touches GUARDS and real watched pages.

Why it matters: this is the first thing CI will report as red the moment clippy passes, and a run that fails one time in three teaches people to re-run instead of read.

Reproduce:

cargo test -p victory-gpu --lib --locked                  # a few times
cargo test -p victory-gpu --lib --locked -- --test-threads=1   # clean

Windows 11 10.0.26100, Rust 1.98.1 (rust-toolchain.toml), x86_64-pc-windows-msvc, MSVC 14.44.35207. No game files; the tests build their own pages.

AI-assisted: yes (DeepSeek Harness, lead agent) — the runs above were made with the toolchain and target the workflow uses.

**@⁠erdemcisse** on GitHub · 2026-12-01 21:54 UTC · [original](https://github.com/RedLightDOWN/VIvidia/issues/4) Once the CI step gets past `clippy` (#3, #2), `cargo test --workspace` runs for the first time — and `victory-gpu`'s `watch` tests fail intermittently, one or two per full run, never the same ones: ``` run A cargo test -p victory-gpu --lib 457 passed; 0 failed run B cargo test -p victory-gpu --lib 455 passed; 2 failed watch::tests::a_block_just_written_rests watch::tests::a_write_is_reported_at_every_checked_view run C cargo test -p victory-gpu --lib 456 passed; 1 failed watch::port7_tests::no_write_is_lost_with_port_7 run D cargo test -p victory-gpu --lib 457 passed; 0 failed run E cargo test -p victory-gpu --lib 457 passed; 0 failed (with my #3 applied) run F cargo test -p victory-gpu --lib 456 passed; 1 failed watch::port7_tests::no_write_is_lost_with_port_7 (with #3) cargo test -p victory-gpu --lib -- --test-threads=1 457 passed; 0 failed cargo test -p victory-gpu --lib watch::tests:: 30 passed; 0 failed (three times in a row, alone) ``` So it is concurrency, not the diff: single-threaded is clean every time, the failures only appear while other tests run alongside, and they move between runs. The assertions that go are about counts on **process-wide** state — `assertion \`left == right\` failed: nothing written yet` in `a_block_just_written_rests`, and the same shape in `a_write_is_reported_at_every_checked_view`. Two shared things are in the neighbourhood, both in `crates/victory-gpu/src/watch.rs`: - `static GUARDS: RwLock<Guards>` (line 2502) with `guards()` taking the **write** lock (2515), and `guards_timed()`/`guards_timed_shared()` taking read ones — every test that calls `guard()`, `writable()`, `published()` or `writes()` goes through it, and the assertions compare *whole* bookkeeping answers (`Some(vec![page])` / `Some(Vec::new())`) rather than "the entry for this view". - real `VirtualAlloc`'d `MEM_WRITE_WATCH` pages (`two_views()`), whose faults are raised by the installed handler on any thread, plus a process-wide `REST_IN_TEST` (`thread_local!`, line 2370) that some tests set to an hour and others read. My guess — not measured — is that a test's assertions see another test's guards or faults, and that the fix is to scope the assertions to the test's own views, or to hold one test mutex for everything that touches `GUARDS` and real watched pages. Why it matters: this is the first thing CI will report as red the moment `clippy` passes, and a run that fails one time in three teaches people to re-run instead of read. Reproduce: ```powershell cargo test -p victory-gpu --lib --locked # a few times cargo test -p victory-gpu --lib --locked -- --test-threads=1 # clean ``` Windows 11 10.0.26100, Rust 1.98.1 (`rust-toolchain.toml`), `x86_64-pc-windows-msvc`, MSVC 14.44.35207. No game files; the tests build their own pages. AI-assisted: yes (DeepSeek Harness, lead agent) — the runs above were made with the toolchain and target the workflow uses.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 21:57:53 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-12-01 21:54 UTC · original

Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

**@⁠github-actions[bot]** on GitHub · 2026-12-01 21:54 UTC · [original](https://github.com/RedLightDOWN/VIvidia/issues/4#issuecomment-7326995112) Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
Author
Owner

@⁠erdemcisse on GitHub · 2026-12-02 18:39 UTC · original

Evidence for the flake/no-flake split, from the clippy branch (#3, e90076c, rebased on main b67c405):

cargo test -p victory-gpu --lib --locked -- --test-threads=1
  -> 466 passed; 5 failed; 36 ignored   (finished in 27.95s)

failures (all deterministic, one thread):
    gpu_owned::tests::dekker_check_refuses_promotion_and_preserves_cpu_write_after_update
    gpu_owned::tests::subregion_circuit_breaker_retires_faulting_chunk_and_preserves_siblings
    gpu_owned::tests::veh_circuit_breaker_batch_demotes_remaining_blocks_on_one_fast_copy
    gpu_owned::tests::veh_read_and_write_fault_pulls_real_gpu_bytes_and_demotes_piece
    gpu_owned::tests::warmup_resets_when_cpu_writes_intervene_between_frames

No watch test failed in that run, which supports the diagnosis here: the watch failures are concurrency, they vanish on one thread, and the five gpu_owned ones do not.

The same five fail on unmodified main b67c405 on this PC (cargo test -p victory-gpu --lib --locked -- gpu_owned::tests:: -> 3 passed; 5 failed), so they are pre-existing and separate from this issue; every one of them panics at assert!(shadow.carded(), …) (gpu_owned.rs:1254/1370/1433/1508/1567), i.e. the host here never reports the test buffer as placed on the card, even with VICTORY_ADAPTER naming the discrete adapter.

Multi-threaded, the whole workspace run on the same branch is 7 failed: the five above, host::menu::tests::the_link_is_always_right_under_the_note when VICTORY_STREAMLINE_DIR is set (#1), and watch::port7_tests::no_write_is_lost_with_port_7.

**@⁠erdemcisse** on GitHub · 2026-12-02 18:39 UTC · [original](https://github.com/RedLightDOWN/VIvidia/issues/4#issuecomment-7354950375) Evidence for the flake/no-flake split, from the clippy branch (#3, `e90076c`, rebased on `main` `b67c405`): ``` cargo test -p victory-gpu --lib --locked -- --test-threads=1 -> 466 passed; 5 failed; 36 ignored (finished in 27.95s) failures (all deterministic, one thread): gpu_owned::tests::dekker_check_refuses_promotion_and_preserves_cpu_write_after_update gpu_owned::tests::subregion_circuit_breaker_retires_faulting_chunk_and_preserves_siblings gpu_owned::tests::veh_circuit_breaker_batch_demotes_remaining_blocks_on_one_fast_copy gpu_owned::tests::veh_read_and_write_fault_pulls_real_gpu_bytes_and_demotes_piece gpu_owned::tests::warmup_resets_when_cpu_writes_intervene_between_frames ``` No `watch` test failed in that run, which supports the diagnosis here: the `watch` failures are concurrency, they vanish on one thread, and the five `gpu_owned` ones do not. The same five fail on unmodified `main` `b67c405` on this PC (`cargo test -p victory-gpu --lib --locked -- gpu_owned::tests::` -> 3 passed; 5 failed), so they are pre-existing and separate from this issue; every one of them panics at `assert!(shadow.carded(), …)` (`gpu_owned.rs:1254/1370/1433/1508/1567`), i.e. the host here never reports the test buffer as placed on the card, even with `VICTORY_ADAPTER` naming the discrete adapter. Multi-threaded, the whole workspace run on the same branch is 7 failed: the five above, `host::menu::tests::the_link_is_always_right_under_the_note` when `VICTORY_STREAMLINE_DIR` is set (#1), and `watch::port7_tests::no_write_is_lost_with_port_7`.
This discussion has been locked. Commenting is limited to contributors.
No description provided.