Skip to content

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

Backlog

Description

@erdemcisse

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.

Activity

  1. github-actions commented on Dec 1, 2026

    @github-actions

    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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions