Raw title copy tests fail now and then in the parallel victory-gpu suite #354

Open
opened 2026-11-27 19:32:20 +00:00 by hamdanpor-ctrl · 11 comments
hamdanpor-ctrl commented 2026-11-27 19:32:20 +00:00 (Migrated from github.com)
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by hamdanpor-ctrl on 2026-11-27T19:32:20Z.


Two tests from the raw title copy work fail now and then in the parallel cargo test -p victory-gpu --locked on main at 104c3d3, although both hold one_asking_test():

Test Failure main, 40 runs
watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges watch.rs:4559: expect("watched destination") on prepare_raw_copy_note(&reading, p, 1) 1
host::refresh_tests::raw_title_copy_keeps_write_watch_and_resends_equal_bytes host.rs:12535: unwrap on None 1

The same two failed once each in another 40 runs on a branch that changes only shadow/loose_allocation_tests.rs (#346).

What did not help: making the eight other tests that ask about write-watched title memory hold the lock as well (what_is_taken_again_is_what_was_written, no_write_is_lost_between_askers, reads_in_place_and_remappings_wait_for_each_other, the_parts_of_a_page_written_since_it_was_taken, written_pages_are_reported_to_every_asker, only_what_differs_goes_up, kept_things_come_back_by_size_within_the_limit, bytes_under_overlapping_ranges). With that, a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges failed 3 of 40 runs, and many_askers_tests::no_mapping_is_lost_between_askers once (watch.rs:5968, assert!(super::published(at, end))). So what ends or replaces the test's asking is probably not another test asking directly; a submission path in a test without the lock is my next guess, but I have not found it. Not posting that branch.

  • PC: RTX 3050 Laptop GPU 4 GB (driver 617.42), i7-12700H, 16 GB, Windows 11 Pro; Rust 1.98.1
  • Full logs of the failing runs are available if useful.

AI-assisted (Claude Code).

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:6653269788 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354). Originally posted by [hamdanpor-ctrl](https://github.com/hamdanpor-ctrl) on 2026-11-27T19:32:20Z. --- Two tests from the raw title copy work fail now and then in the parallel `cargo test -p victory-gpu --locked` on `main` at `104c3d3`, although both hold `one_asking_test()`: | Test | Failure | `main`, 40 runs | |---|---|---:| | `watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges` | `watch.rs:4559`: `expect("watched destination")` on `prepare_raw_copy_note(&reading, p, 1)` | 1 | | `host::refresh_tests::raw_title_copy_keeps_write_watch_and_resends_equal_bytes` | `host.rs:12535`: unwrap on `None` | 1 | The same two failed once each in another 40 runs on a branch that changes only `shadow/loose_allocation_tests.rs` (#346). What did not help: making the eight other tests that ask about write-watched title memory hold the lock as well (`what_is_taken_again_is_what_was_written`, `no_write_is_lost_between_askers`, `reads_in_place_and_remappings_wait_for_each_other`, `the_parts_of_a_page_written_since_it_was_taken`, `written_pages_are_reported_to_every_asker`, `only_what_differs_goes_up`, `kept_things_come_back_by_size_within_the_limit`, `bytes_under_overlapping_ranges`). With that, `a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges` failed 3 of 40 runs, and `many_askers_tests::no_mapping_is_lost_between_askers` once (`watch.rs:5968`, `assert!(super::published(at, end))`). So what ends or replaces the test's asking is probably not another test asking directly; a submission path in a test without the lock is my next guess, but I have not found it. Not posting that branch. - PC: RTX 3050 Laptop GPU 4 GB (driver 617.42), i7-12700H, 16 GB, Windows 11 Pro; Rust 1.98.1 - Full logs of the failing runs are available if useful. AI-assisted (Claude Code).
TaynanGT commented 2026-11-27 19:51:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T19:51:36Z.


@hamdanpor-ctrl I found a submission test that can end the shared query: a_late_texture_readback_blocks_a_following_cpu_copy calls Host::submit, which calls ask_once_end(). The readback fixture was outside the lock held by both raw-copy tests.

#361 takes the same lock in that fixture. #344 separately gave the host raw-copy test a stable mapping. I’ve kept this issue open for the remaining intermittent cases.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7226939846 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7226939846). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T19:51:36Z. --- @hamdanpor-ctrl I found a submission test that can end the shared query: `a_late_texture_readback_blocks_a_following_cpu_copy` calls `Host::submit`, which calls `ask_once_end()`. The readback fixture was outside the lock held by both raw-copy tests. #361 takes the same lock in that fixture. #344 separately gave the host raw-copy test a stable mapping. I’ve kept this issue open for the remaining intermittent cases.
hamdanpor-ctrl commented 2026-11-27 20:13:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by hamdanpor-ctrl on 2026-11-27T20:13:44Z.


More data from the same laptop, cargo test -p victory-gpu --locked, parallel:

Commit Runs Failed Which
aa917f3 10 1 raw copy in watched memory
b6ea434 (#346) 10 2 one each
1d83085 (#351) 40 23 raw_title_copy_keeps_write_watch_and_resends_equal_bytes 19, a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges 8
1d83085 (#351), again later 10 7 6 and 3
2d97073 10 1 raw title copy

2d97073 contains 1d83085, and the commits between them (#350, #356, the README) don't touch watch.rs or the refresh tests, yet the rate fell back. So these two look very sensitive to timing or to how the test binary happens to be laid out, not tied to one change; 1d83085 is just a build where they fail most of the time here, which may make it the easiest one to debug on.

AI-assisted (Claude Code).

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7227299261 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7227299261). Originally posted by [hamdanpor-ctrl](https://github.com/hamdanpor-ctrl) on 2026-11-27T20:13:44Z. --- More data from the same laptop, `cargo test -p victory-gpu --locked`, parallel: | Commit | Runs | Failed | Which | |---|---:|---:|---| | `aa917f3` | 10 | 1 | raw copy in watched memory | | `b6ea434` (#346) | 10 | 2 | one each | | `1d83085` (#351) | 40 | 23 | `raw_title_copy_keeps_write_watch_and_resends_equal_bytes` 19, `a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges` 8 | | `1d83085` (#351), again later | 10 | 7 | 6 and 3 | | `2d97073` | 10 | 1 | raw title copy | `2d97073` contains `1d83085`, and the commits between them (#350, #356, the README) don't touch `watch.rs` or the refresh tests, yet the rate fell back. So these two look very sensitive to timing or to how the test binary happens to be laid out, not tied to one change; `1d83085` is just a build where they fail most of the time here, which may make it the easiest one to debug on. AI-assisted (Claude Code).
hamdanpor-ctrl commented 2026-11-27 20:29:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by hamdanpor-ctrl on 2026-11-27T20:29:26Z.


Narrowed on 1d83085, where the full parallel suite fails these about 7 times in 10 here. 10 runs per group, cargo test -p victory-gpu --locked -- <filter>:

Run beside the two tests Tests run Raw-copy failure
nothing (the two tests alone) 2 0 of 10
watch:: 51 3 of 10 (a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges)
host::refresh_tests:: 10 0 of 10
host:: 172 0 of 10
everything but host:: (--skip host::, so watch:: included) 389 0 of 10

The last group contains the watch:: one yet never failed, so I don't think a single other test is the cause; together with the rate moving between builds, it looks like a timing race in the raw-copy path or its test (perhaps against a background thread) that other tests only make more or less likely.

AI-assisted (Claude Code).

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7227555537 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7227555537). Originally posted by [hamdanpor-ctrl](https://github.com/hamdanpor-ctrl) on 2026-11-27T20:29:26Z. --- Narrowed on `1d83085`, where the full parallel suite fails these about 7 times in 10 here. 10 runs per group, `cargo test -p victory-gpu --locked -- <filter>`: | Run beside the two tests | Tests run | Raw-copy failure | |---|---:|---:| | nothing (the two tests alone) | 2 | 0 of 10 | | `watch::` | 51 | 3 of 10 (`a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges`) | | `host::refresh_tests::` | 10 | 0 of 10 | | `host::` | 172 | 0 of 10 | | everything but `host::` (`--skip host::`, so `watch::` included) | 389 | 0 of 10 | The last group contains the `watch::` one yet never failed, so I don't think a single other test is the cause; together with the rate moving between builds, it looks like a timing race in the raw-copy path or its test (perhaps against a background thread) that other tests only make more or less likely. AI-assisted (Claude Code).
TaynanGT commented 2026-11-29 11:24:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T11:24:09Z.


Thanks for the ten-run matrix. The changing failure rate points toward timing or shared state rather than a proven single conflicting test. I'd investigate the background-thread interaction and shared raw-copy state first, without hiding the failure behind retries or sleeps.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7255087127 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7255087127). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T11:24:09Z. --- Thanks for the ten-run matrix. The changing failure rate points toward timing or shared state rather than a proven single conflicting test. I'd investigate the background-thread interaction and shared raw-copy state first, without hiding the failure behind retries or sleeps.
Kal0s-design commented 2026-11-29 13:29:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by Kal0s-design on 2026-11-29T13:29:04Z.


The second cause under parallel load is in the test: after a raw copy the journal keeps the query only while the global changes() count is unchanged, and other fixtures remap unrelated pages meanwhile. 9 of 100 stressed runs failed on #439's branch, and with a retry when the mapping moved it's 0 of 100. #443 against #439's branch has the details.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7256571489 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7256571489). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-29T13:29:04Z. --- The second cause under parallel load is in the test: after a raw copy the journal keeps the query only while the global `changes()` count is unchanged, and other fixtures remap unrelated pages meanwhile. 9 of 100 stressed runs failed on #439's branch, and with a retry when the mapping moved it's 0 of 100. #443 against #439's branch has the details.
TaynanGT commented 2026-11-29 14:39:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T14:39:02Z.


I integrated the bounded retry from #443 locally as 349e595d7. All three targeted raw_title_copy tests passed on Windows. The retry is restricted to a changed global mapping, so the stable-mapping assertion remains intact. The broader parallel stress run is still needed.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7257468319 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7257468319). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T14:39:02Z. --- I integrated the bounded retry from #443 locally as 349e595d7. All three targeted raw_title_copy tests passed on Windows. The retry is restricted to a changed global mapping, so the stable-mapping assertion remains intact. The broader parallel stress run is still needed.
Kal0s-design commented 2026-11-29 16:45:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by Kal0s-design on 2026-11-29T16:45:29Z.


The last flake I found under parallel load (no_mapping_is_lost_between_askers, about 1 in 250 to 300 runs) is in #449. The test's own placeholders weren't told to the watch, so it asked Windows, whose answer can be wrong for a moment during a concurrent unmap. The runtime tells of its placeholders through xmem, so it isn't affected.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7259153392 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7259153392). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-29T16:45:29Z. --- The last flake I found under parallel load (`no_mapping_is_lost_between_askers`, about 1 in 250 to 300 runs) is in #449. The test's own placeholders weren't told to the watch, so it asked Windows, whose answer can be wrong for a moment during a concurrent unmap. The runtime tells of its placeholders through xmem, so it isn't affected.
TaynanGT commented 2026-11-29 19:02:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T19:02:04Z.


Thanks for isolating the remaining flake in #449. The fixture needs to register its placeholders just as the runtime does. Let's keep the original runtime assertions intact and verify both fixes under parallel stress before treating the issue as resolved.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7260952999 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7260952999). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T19:02:04Z. --- Thanks for isolating the remaining flake in #449. The fixture needs to register its placeholders just as the runtime does. Let's keep the original runtime assertions intact and verify both fixes under parallel stress before treating the issue as resolved.
Kal0s-design commented 2026-11-29 20:03:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by Kal0s-design on 2026-11-29T20:03:24Z.


Parallel stress of #443 and #449 together on the consolidated branch, as asked here and on #449.

Setup:

  • Base: #439's branch at cfd5ebd.
  • With fixes: cfd5ebd with #443's commit and #449's commit cherry-picked on top (both apply cleanly).
  • Each run is the victory-gpu lib test binary filtered to host::refresh_tests watch:: with --test-threads=8. Base and fixed batches ran at the same time, 3-4 processes of each at once, so the load was the same for both.
runs failing runs which
cfd5ebd 250 4 raw_title_copy_keeps_write_watch_and_resends_equal_bytes at after.expect("the copy preserves the query") ×3; no_mapping_is_lost_between_askers at assert!(super::published(at, end)) ×1
cfd5ebd + #443 + #449 250 0 none

The four base failures are exactly the two assertions the two PRs address. Both PRs leave the runtime assertions as they were: #443 retries only when the global mapping count moved, and #449 only registers the fixture's placeholders. Nothing else failed in either set.

These are small counts. 4 against 0 of 250 is consistent with both fixes, but on its own it isn't strong proof. The probe evidence in #443 and #449 (what each failure was, and the A/B on the probe events) carries more weight. One detail for exactness: the base binary had a print-only probe in a third test, a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges, which prints only when that test fails, and it never did. I mapped the panic lines back to cfd5ebd's source with that offset accounted for.

AI-assisted: yes

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7261770576 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7261770576). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-29T20:03:24Z. --- Parallel stress of #443 and #449 together on the consolidated branch, as asked here and on #449. **Setup:** - Base: #439's branch at cfd5ebd. - With fixes: cfd5ebd with #443's commit and #449's commit cherry-picked on top (both apply cleanly). - Each run is the `victory-gpu` lib test binary filtered to `host::refresh_tests watch::` with `--test-threads=8`. Base and fixed batches ran at the same time, 3-4 processes of each at once, so the load was the same for both. | | runs | failing runs | which | |---|---:|---:|---| | cfd5ebd | 250 | **4** | `raw_title_copy_keeps_write_watch_and_resends_equal_bytes` at `after.expect("the copy preserves the query")` ×3; `no_mapping_is_lost_between_askers` at `assert!(super::published(at, end))` ×1 | | cfd5ebd + #443 + #449 | 250 | **0** | none | The four base failures are exactly the two assertions the two PRs address. Both PRs leave the runtime assertions as they were: #443 retries only when the global mapping count moved, and #449 only registers the fixture's placeholders. Nothing else failed in either set. These are small counts. 4 against 0 of 250 is consistent with both fixes, but on its own it isn't strong proof. The probe evidence in #443 and #449 (what each failure was, and the A/B on the probe events) carries more weight. One detail for exactness: the base binary had a print-only probe in a third test, `a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges`, which prints only when that test fails, and it never did. I mapped the panic lines back to cfd5ebd's source with that offset accounted for. AI-assisted: yes
TaynanGT commented 2026-11-30 17:01:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:01:23Z.


main has moved to a new line of the code and everything is now named Vice-Tay: vice-tay.exe play, and VICE_TAY_* switches instead of VICTORY_* (details in #468). Could you check whether this still happens on the current main and say so here, with a log if you can?

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285596149 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7285596149). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:01:23Z. --- `main` has moved to a new line of the code and everything is now named Vice-Tay: `vice-tay.exe play`, and `VICE_TAY_*` switches instead of `VICTORY_*` (details in #468). Could you check whether this still happens on the current `main` and say so here, with a log if you can?
TaynanGT commented 2026-11-30 20:16:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T20:16:19Z.


Neither of these tests is in this tree any more. watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges and host::refresh_tests::... don't exist on current main - main moved to a different line of the code on 30 November (#468) and the raw-title-copy work came from the old one.

So I can't reproduce this and I'm not going to close it as fixed either: the code it describes is gone rather than repaired, and the same race could well exist under another name here.

If you still have the 40-run harness, pointing it at the current cargo test -p vice-tay-gpu --locked would be genuinely useful. Flaky tests in the parallel suite are the kind of thing that hides a real ordering bug, and your method for catching them is better than anything I have.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7290659372 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/issues/354#issuecomment-7290659372). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T20:16:19Z. --- Neither of these tests is in this tree any more. `watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges` and `host::refresh_tests::...` don't exist on current `main` - `main` moved to a different line of the code on 30 November (#468) and the raw-title-copy work came from the old one. So I can't reproduce this and I'm not going to close it as fixed either: the code it describes is gone rather than repaired, and the same race could well exist under another name here. If you still have the 40-run harness, pointing it at the current `cargo test -p vice-tay-gpu --locked` would be genuinely useful. Flaky tests in the parallel suite are the kind of thing that hides a real ordering bug, and your method for catching them is better than anything I have.
Sign in to join this conversation.
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
TaynanGT/Vice-Tay#354
No description provided.