Tell the askers test's placeholders to the watch, as xmem does (#354) #449

Closed
github-bot wants to merge 1 commit from github-bot/gh-449 into review/local-integration-20261129 AGit
Owner

@⁠Kal0s-design on GitHub · 2026-11-29 16:45 UTC · original
Kal0s-design:fix/askers-test-registers-placeholders → review/local-integration-20261129 · +8 −0 · 1 files · 1 commits · closed without merging

Targets #439's branch. Test-only, one call. Refs #354.

watch::many_askers_tests::no_mapping_is_lost_between_askers fails about once in 250 to 300 runs of host::refresh_tests watch:: under parallel load (3 failures over roughly 800 runs today), always at the last assert!(super::published(at, end)).

The captured failure. With temporary probes I caught one. Every block of the test was published except one, and that block was noted absent but not held (not a known hole), though it was a placeholder hole. A probe where protect_here notes a hole showed what happened: placeholder(block) answered false, and the same call right after answered true. VirtualQuery already reported MEM_RESERVE for that block.

Why it sticks. The test reserves its placeholders itself and never calls title_memory_placeholder, so placeholder() falls back to NtQueryVirtualMemory(MemoryRegionInformationEx). While another thread is unmapping a view back into its placeholder, that answer can say free (MEM_FREE) or private memory for a moment. A block noted absent but not held is then never asked again whether it is a placeholder. The unsure pass in writes only checks whether it was committed. It stays unpublished until the next title_memory_* change for that block. Only the unmap side can stick: a remap tells before anything else and wipes absent.

Why the runtime doesn't take this path. xmem tells of every placeholder it reserves (xmem.rs, the title_memory_placeholder call after XMemVirtualAlloc, the 32-bit heap's kind 0x42000 included), and placeholder() reads the PLACEHOLDERS bits before asking Windows. The bit survives mapping and unmapping. title_memory_remapped, title_memory_unmapping and title_memory_splitting don't touch it, and only title_memory_allocated and title_memory_freed forget it. xmem calls title_memory_freed only for a release without MEM_PRESERVE_PLACEHOLDER/coalesce. So the fix is the test telling of its reservation the same way.

Measured. Same probe in both builds, 240 runs each side by side, counting where placeholder() said no for a hole on the test's unnamed threads. Without the call there were 9 (7 MEM_FREE, 2 private), and with it 0. The fallback query is simply not reached for this test's blocks any more. Probe lines from another test that uses non-placeholder holes on purpose were the same in both builds (240/240), so the load matched. As a regression check, 480 clean runs with the change gave no new failures. The only failures were raw_title_copy, which this base doesn't have #443 for yet. That isn't proof by itself: at this rate 0 in 480 can happen without a fix.

#402 skips this test where the placeholder query isn't answered (Wine). With the placeholders told, the test no longer needs that query, so it might run there instead. I can't check Wine.

Clippy on this branch shows only the errors #442 fixes. cargo test -p victory-gpu --lib watch:: passes (50).

AI-assisted: yes

🤖 Generated with Claude Code

**@⁠Kal0s-design** on GitHub · 2026-11-29 16:45 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/449) `Kal0s-design:fix/askers-test-registers-placeholders` → `review/local-integration-20261129` · +8 −0 · 1 files · 1 commits · closed without merging Targets #439's branch. Test-only, one call. Refs #354. `watch::many_askers_tests::no_mapping_is_lost_between_askers` fails about once in 250 to 300 runs of `host::refresh_tests watch::` under parallel load (3 failures over roughly 800 runs today), always at the last `assert!(super::published(at, end))`. **The captured failure.** With temporary probes I caught one. Every block of the test was published except one, and that block was noted `absent` but not `held` (not a known hole), though it was a placeholder hole. A probe where `protect_here` notes a hole showed what happened: `placeholder(block)` answered **false**, and the same call right after answered **true**. VirtualQuery already reported `MEM_RESERVE` for that block. **Why it sticks.** The test reserves its placeholders itself and never calls `title_memory_placeholder`, so `placeholder()` falls back to `NtQueryVirtualMemory(MemoryRegionInformationEx)`. While another thread is unmapping a view back into its placeholder, that answer can say free (`MEM_FREE`) or private memory for a moment. A block noted absent but not held is then never asked again whether it is a placeholder. The `unsure` pass in `writes` only checks whether it was committed. It stays unpublished until the next `title_memory_*` change for that block. Only the unmap side can stick: a remap tells before anything else and wipes `absent`. **Why the runtime doesn't take this path.** xmem tells of every placeholder it reserves (`xmem.rs`, the `title_memory_placeholder` call after `XMemVirtualAlloc`, the 32-bit heap's kind 0x42000 included), and `placeholder()` reads the `PLACEHOLDERS` bits before asking Windows. The bit survives mapping and unmapping. `title_memory_remapped`, `title_memory_unmapping` and `title_memory_splitting` don't touch it, and only `title_memory_allocated` and `title_memory_freed` forget it. xmem calls `title_memory_freed` only for a release without `MEM_PRESERVE_PLACEHOLDER`/coalesce. So the fix is the test telling of its reservation the same way. **Measured.** Same probe in both builds, 240 runs each side by side, counting where `placeholder()` said no for a hole on the test's unnamed threads. Without the call there were 9 (7 `MEM_FREE`, 2 private), and with it 0. The fallback query is simply not reached for this test's blocks any more. Probe lines from another test that uses non-placeholder holes on purpose were the same in both builds (240/240), so the load matched. As a regression check, 480 clean runs with the change gave no new failures. The only failures were `raw_title_copy`, which this base doesn't have #443 for yet. That isn't proof by itself: at this rate 0 in 480 can happen without a fix. #402 skips this test where the placeholder query isn't answered (Wine). With the placeholders told, the test no longer needs that query, so it might run there instead. I can't check Wine. Clippy on this branch shows only the errors #442 fixes. `cargo test -p victory-gpu --lib watch::` passes (50). AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
no_mapping_is_lost_between_askers failed about once in 250 to 300
stressed runs at its last `published(at, end)`. The test reserves its
placeholders itself and never calls `title_memory_placeholder`, so
`placeholder()` asks Windows (MemoryRegionInformationEx). While another
thread is unmapping a view back into its placeholder that answer can
say free or private memory. The block is then noted absent but not a
known hole, the next askings only look whether it was committed, and it
stays unpublished.

The runtime does not take that path: xmem tells of every placeholder it
reserves, and the bit stays through mapping and unmapping (only
title_memory_allocated and title_memory_freed forget it). The test now
tells of its reservation the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 16:48:50 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-29 19:09 UTC · original

Thanks for capturing the transient placeholder-query failure and matching the fixture to xmem's registration path. The probe results are stronger evidence than the zero failures alone. Keep this test-only, preserve the final published assertion, and verify it together with #443 on the consolidated branch. Wine coverage should remain conditional until tested.

**@⁠TaynanGT** on GitHub · 2026-11-29 19:09 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/449#issuecomment-7261051103) Thanks for capturing the transient placeholder-query failure and matching the fixture to xmem's registration path. The probe results are stronger evidence than the zero failures alone. Keep this test-only, preserve the final published assertion, and verify it together with #443 on the consolidated branch. Wine coverage should remain conditional until tested.
Author
Owner

@⁠Kal0s-design on GitHub · 2026-11-29 20:03 UTC · original

Verified together with #443 on cfd5ebd under parallel stress: 4 of 250 base runs failed (the two assertions these PRs address), 0 of 250 with both. Details and caveats on #354.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-11-29 20:03 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/449#issuecomment-7261770864) Verified together with #443 on cfd5ebd under parallel stress: 4 of 250 base runs failed (the two assertions these PRs address), 0 of 250 with both. Details and caveats on #354. AI-assisted: yes
github-bot closed this pull request 2026-11-30 17:08:33 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 17:06 UTC · original

main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

**@⁠TaynanGT** on GitHub · 2026-11-30 17:06 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/449#issuecomment-7285725710) `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.