Tests: a tick between the origin polls' zero-time-out asks is asked again #3080

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

@⁠kotekompotek on GitHub · 2026-11-26 06:53 UTC · original
kotekompotek:tests/origin-poll-tick-boundary → main · +17 −7 · 1 files · 1 commits · open

Summary

CI on #2810 failed frame::tests::waits_end_on_ticks_and_count_frames at frame.rs:235 (left: S_OK, right: TIMEOUT) — a flake, not that PR's change (it only touches host.rs copy ordering; this test passed at its previous head).

The test polls the origin with a zero time-out twice in a row (lines 231 and 235). A wait only times out while the next tick is not due, and the interval here is 2 ms — a host that wakes the thread a whole tick late between the two asks makes the second one return S_OK. Probability per run is the inter-ask gap over the interval, which a loaded CI runner can hit.

  • Each zero-time-out ask now retries (bounded) until one really times out. A hit takes its tick, so the retry sees the following tick a whole interval out — the loop terminates in one extra ask in practice.
  • early == second + 1 becomes early > second: a boundary hit takes a frame token too, so a retry may have bumped early/second further. The consecutive-token invariant (next == early + 1) and the timeout-token semantics are preserved.

The second half of the test (50 ms flip ticks, unbounded waits) is unaffected.

Test plan

  • cargo test -p victory-gpu frame:: — both frame tests pass
  • cargo clippy -p victory-gpu --all-targets -D warnings clean
  • CI green on the PR that exposed it (#2810) once this or a re-run lands

Generated with Devin

**@⁠kotekompotek** on GitHub · 2026-11-26 06:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/3080) `kotekompotek:tests/origin-poll-tick-boundary` → `main` · +17 −7 · 1 files · 1 commits · open ## Summary CI on #2810 failed `frame::tests::waits_end_on_ticks_and_count_frames` at `frame.rs:235` (`left: S_OK, right: TIMEOUT`) — a flake, not that PR's change (it only touches `host.rs` copy ordering; this test passed at its previous head). The test polls the origin with a zero time-out twice in a row (lines 231 and 235). A wait only times out while the next tick is not due, and the interval here is **2 ms** — a host that wakes the thread a whole tick late between the two asks makes the second one return `S_OK`. Probability per run is the inter-ask gap over the interval, which a loaded CI runner can hit. - Each zero-time-out ask now retries (bounded) until one really times out. A hit takes its tick, so the retry sees the following tick a whole interval out — the loop terminates in one extra ask in practice. - `early == second + 1` becomes `early > second`: a boundary hit takes a frame token too, so a retry may have bumped `early`/`second` further. The consecutive-token invariant (`next == early + 1`) and the timeout-token semantics are preserved. The second half of the test (50 ms flip ticks, unbounded waits) is unaffected. #### Test plan - [x] `cargo test -p victory-gpu frame::` — both frame tests pass - [x] `cargo clippy -p victory-gpu --all-targets -D warnings` clean - [ ] CI green on the PR that exposed it (#2810) once this or a re-run lands Generated with [Devin](https://devin.ai)
waits_end_on_ticks_and_count_frames polls the origin with a zero
time-out twice in a row; a wait only times out while the next 2 ms tick
is not due, and a host that wakes the thread a whole tick late between
the asks (seen in CI: left S_OK, right TIMEOUT) makes the second one
succeed. Each ask now retries until one really does time out; a hit
takes its tick, so the retry sees the following tick a whole interval
out. Frame tokens a boundary hit took are counted in the asserts.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:55:01 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 08:16 UTC · original

Independent verification for my claim #1633. Test report only; no source review. Disclosure: checks run by Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol).

Tested: PR head 5a4f4697d18376d8004c91061d4b01706e4ce6e9, parent 63bcca43c6a00a758510398fa43096ce7e4f7df0 (current main). Windows 11 x64 (16 logical CPUs), Rust 1.98.1, cargo -j 4 --locked. CPU only; no GPU or device used. Both revisions were run from separately built victory-gpu lib test binaries, frame:: filter (2 tests: waits_begun_together_take_different_ticks, waits_end_on_ticks_and_count_frames), each run capped at 60 s, parent and head interleaved.

Condition Parent Head
Idle machine, 40 runs each 40/40 pass 40/40 pass
Moderate load (12 busy-loop processes on 16 CPUs), 40 runs each 25/40 pass 37/40 pass
Heavy load (32 busy-loop processes, 2x oversubscribed), 60 runs each 1/60 pass 20/60 pass

Failure sites:

  • Parent under load: all failures are waits_end_on_ticks_and_count_frames at the frame.rs zero-time-out assertion (left: 0, right: 1). That is the assertion the PR rewrites. Under moderate load this was 13 of 15 failures, the other 2 being the 10 ms bound at line 271.
  • Head, moderate load: 3 failures, all the before.elapsed() < 10 ms assertion (parent line 271, head line 281). It is an existing assertion this PR does not touch, and it fails at the parent in the same runs. No failure at the changed lines.
  • Head, heavy load: 31 failures are the PR's own ten zero-time-out waits each met a due tick panic. 9 are the 10 ms assertion at line 281. At 2x oversubscription ten consecutive asks all met a due tick, so the retry loop does not make the test immune there.

Conclusion: reproducible, not a one-off flake. The parent's zero-time-out assertion fails often under CPU contention, and the head removes most of it (moderate load: 25/40 to 37/40; heavy load: 1/60 to 20/60). Idle runs were clean in both. The remaining head failures under load come from the PR's retry bound (heavy load only) and from the separate 10 ms elapsed-time assertion, which also fails at the parent. They are timing-sensitive tests under artificial contention, not evidence of a logic regression. I did not test CI-like conditions. Scratch worktree, binaries and cargo target directory were removed afterwards.

**@⁠oni-swr** on GitHub · 2026-11-26 08:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3080#issuecomment-7186398162) Independent verification for my claim https://git.gtahub.st/github/Marvisak--VIctory/issues/1633. Test report only; no source review. Disclosure: checks run by Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol). **Tested:** PR head `5a4f4697d18376d8004c91061d4b01706e4ce6e9`, parent `63bcca43c6a00a758510398fa43096ce7e4f7df0` (current `main`). Windows 11 x64 (16 logical CPUs), Rust 1.98.1, `cargo -j 4 --locked`. CPU only; no GPU or device used. Both revisions were run from separately built `victory-gpu` lib test binaries, `frame::` filter (2 tests: `waits_begun_together_take_different_ticks`, `waits_end_on_ticks_and_count_frames`), each run capped at 60 s, parent and head interleaved. | Condition | Parent | Head | |---|---|---| | Idle machine, 40 runs each | 40/40 pass | 40/40 pass | | Moderate load (12 busy-loop processes on 16 CPUs), 40 runs each | 25/40 pass | 37/40 pass | | Heavy load (32 busy-loop processes, 2x oversubscribed), 60 runs each | 1/60 pass | 20/60 pass | **Failure sites:** - Parent under load: all failures are `waits_end_on_ticks_and_count_frames` at the `frame.rs` zero-time-out assertion (`left: 0, right: 1`). That is the assertion the PR rewrites. Under moderate load this was 13 of 15 failures, the other 2 being the 10 ms bound at line 271. - Head, moderate load: 3 failures, all the `before.elapsed() < 10 ms` assertion (parent line 271, head line 281). It is an existing assertion this PR does not touch, and it fails at the parent in the same runs. No failure at the changed lines. - Head, heavy load: 31 failures are the PR's own `ten zero-time-out waits each met a due tick` panic. 9 are the 10 ms assertion at line 281. At 2x oversubscription ten consecutive asks all met a due tick, so the retry loop does not make the test immune there. **Conclusion:** reproducible, not a one-off flake. The parent's zero-time-out assertion fails often under CPU contention, and the head removes most of it (moderate load: 25/40 to 37/40; heavy load: 1/60 to 20/60). Idle runs were clean in both. The remaining head failures under load come from the PR's retry bound (heavy load only) and from the separate 10 ms elapsed-time assertion, which also fails at the parent. They are timing-sensitive tests under artificial contention, not evidence of a logic regression. I did not test CI-like conditions. Scratch worktree, binaries and cargo target directory were removed afterwards.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 08:22 UTC · original

Automated triage for the maintainers.

Merge candidate. Test-only fix for a real flake in frame::tests::waits_end_on_ticks_and_count_frames. With a 2 ms interval, next_tick returns S_OK for a zero-time-out wait once more than a tick has passed since the last one taken, so a thread that wakes late on a loaded runner fails the TIMEOUT assertion. The bounded retry takes the due tick and then times out on the next one. Relaxing early == second + 1 to early > second is correct because each origin hit also bumps FRAME, and next == early + 1 still checks that tokens are consecutive. No change outside the test. CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 08:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3080#issuecomment-7186514648) <!-- victory-triage v1 head=5a4f4697d18376d8004c91061d4b01706e4ce6e9 verdict=merge-candidate at=2026-11-26T08:18:02Z --> Automated triage for the maintainers. Merge candidate. Test-only fix for a real flake in `frame::tests::waits_end_on_ticks_and_count_frames`. With a 2 ms interval, `next_tick` returns `S_OK` for a zero-time-out wait once more than a tick has passed since the last one taken, so a thread that wakes late on a loaded runner fails the `TIMEOUT` assertion. The bounded retry takes the due tick and then times out on the next one. Relaxing `early == second + 1` to `early > second` is correct because each origin hit also bumps `FRAME`, and `next == early + 1` still checks that tokens are consecutive. No change outside the test. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 08:31 UTC · original · approved these changes

Verified against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib frame:: -- --test-threads=1: 2/2 passed (waits_begun_together_take_different_ticks and waits_end_on_ticks_and_count_frames).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly removes the timing flake when a tick lands between zero-timeout origin polls.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 08:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/3080#pullrequestreview-6070745829) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib frame:: -- --test-threads=1`: 2/2 passed (`waits_begun_together_take_different_ticks` and `waits_end_on_ticks_and_count_frames`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly removes the timing flake when a tick lands between zero-timeout origin polls. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 08:56 UTC · original · requested changes

Verified 5a4f4697 locally on Windows 11 x64:

  • cargo clippy --all-targets --locked -- -D warnings: clean (3.38s).
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.34s).
  • cargo test -p victory-gpu --lib --locked frame::: 2 passed, 0 failed (0.31s), plus 20/20 consecutive runs (6.92s) and 40/40 across 8 concurrent workers on the compiled test binary. Production code (frame.rs:1-215) is unchanged.

One test-assertion gap in timed_out(TOKEN_ON_TIMEOUT, &mut early) (crates/victory-gpu/src/frame.rs:236-251): passing the same &mut early across retries can mask a timeout-token regression. Because wait also writes *token on S_OK (frame.rs:156-162), if an earlier retry hits a due tick (S_OK) and updates early, and the next call returns TIMEOUT without writing *token, early keeps the S_OK value and the subsequent early > second && next == early + 1 assertions still pass.

Please reset *token = 0 (or record current() before each attempt) so the test directly asserts that the specific TIMEOUT call itself wrote the incremented frame token (and that the flags == 0 TIMEOUT left *token untouched).

**@⁠fuzeofficlal** on GitHub · 2026-11-26 08:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/3080#pullrequestreview-6071052750) · **requested changes** Verified `5a4f4697` locally on Windows 11 x64: - `cargo clippy --all-targets --locked -- -D warnings`: clean (`3.38s`). - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: 1 passed, 0 failed (`0.34s`). - `cargo test -p victory-gpu --lib --locked frame::`: 2 passed, 0 failed (`0.31s`), plus `20/20` consecutive runs (`6.92s`) and `40/40` across 8 concurrent workers on the compiled test binary. Production code (`frame.rs:1-215`) is unchanged. One test-assertion gap in `timed_out(TOKEN_ON_TIMEOUT, &mut early)` (`crates/victory-gpu/src/frame.rs:236-251`): passing the same `&mut early` across retries can mask a timeout-token regression. Because `wait` also writes `*token` on `S_OK` (`frame.rs:156-162`), if an earlier retry hits a due tick (`S_OK`) and updates `early`, and the next call returns `TIMEOUT` without writing `*token`, `early` keeps the `S_OK` value and the subsequent `early > second && next == early + 1` assertions still pass. Please reset `*token = 0` (or record `current()` before each attempt) so the test directly asserts that the specific `TIMEOUT` call itself wrote the incremented frame token (and that the `flags == 0` `TIMEOUT` left `*token` untouched).
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 10:41 UTC · original

NVIDIA full-suite run, to go with the reports above by Dukestar69, fuzeofficlal, oni-swr, since none of them names a GPU run. Tested exact head 5a4f469 (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 866 passed, 0 failed, 10 ignored.
  • No new #[test] functions in the diff.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 10:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/3080#issuecomment-7189705911) NVIDIA full-suite run, to go with the reports above by Dukestar69, fuzeofficlal, oni-swr, since none of them names a GPU run. Tested exact head `5a4f469` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **866 passed, 0 failed, 10 ignored**. - No new `#[test]` functions in the diff. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠jaschinski97-ops on GitHub · 2026-11-26 15:41 UTC · original

Fresh Windows MSVC CI evidence for the zero-timeout origin poll: on main 63bcca43 plus the save-only #2675, frame::tests::waits_end_on_ticks_and_count_frames failed at frame.rs231, observed S_OK(0), expected TIMEOUT(1). The same frame.rs is unchanged in that PR. Current #2677 on the same main passed CI.

Failing job: https://github.com/Marvisak/VIctory/actions/runs/45850563859/job/140015510444 . App tests and both Clippy configurations passed before the workspace stopped at this frame test (230 GPU tests passed, 1 failed, 1 ignored).

This appears to be the same live-clock zero-poll assumption addressed here, rather than a save migration failure. Reporting the existing CI result only; no duplicate implementation or new GPU test run. AI-assisted triage with Codex.

**@⁠jaschinski97-ops** on GitHub · 2026-11-26 15:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/3080#issuecomment-7196611332) Fresh Windows MSVC CI evidence for the zero-timeout origin poll: on main `63bcca43` plus the save-only #2675, `frame::tests::waits_end_on_ticks_and_count_frames` failed at frame.rs231, observed S_OK(0), expected TIMEOUT(1). The same frame.rs is unchanged in that PR. Current #2677 on the same main passed CI. Failing job: https://github.com/Marvisak/VIctory/actions/runs/45850563859/job/140015510444 . App tests and both Clippy configurations passed before the workspace stopped at this frame test (230 GPU tests passed, 1 failed, 1 ignored). This appears to be the same live-clock zero-poll assumption addressed here, rather than a save migration failure. Reporting the existing CI result only; no duplicate implementation or new GPU test run. AI-assisted triage with Codex.
This pull request can be merged automatically.
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/3080/head:github-bot/gh-3080'
git switch 'github-bot/gh-3080'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3080'
git switch 'github-bot/gh-3080'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3080'
git switch 'github-bot/gh-3080'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3080'
git switch 'main'
git merge --squash 'github-bot/gh-3080'
git switch 'main'
git merge --ff-only 'github-bot/gh-3080'
git switch 'main'
git merge 'github-bot/gh-3080'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3080
No description provided.