hle(host_posix): a Sleep of 100 ms or more must not consume title time while the host holds a thread (sleep hold) #646
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS#646
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AnastasisKon on GitHub · 2026-11-28 21:34 UTC · original
What
Sleep(crates/victory-hle/src/host_posix.rs:133) is a plainthread::sleep. The title's boot watchdog counts time while the host is slow: the 18 s int3 at image+0x4dcbc9d runs on time (its iterations), not frames (docs/native-host.md, "The int3 at image+0x4dcbc9d"), with 23k pipeline-creation calls and 70kWaitForSingleObjectin those 18 s.MacBox/XCL hit the same class of failure on GTA VI: a retail title's own stall check — a thread that ticks once a second with
Sleepand ends the process after 30 ticks without a sign of its main thread — fired while the driver built the pipelines of its world (XCL #509, #232). XCL #1288's sleep hold fixed it: aSleepof 100 ms or more is taken in steps of at most 20 ms, and the time the host holds one of the title's threads (a pipeline bind in progress,pso_async::title_held) is not subtracted from the sleep; shorter sleeps (polling, streaming, sound) pass through unchanged,XCL_SLEEP_HOLD=0restores the plain host Sleep. With the hold, a loading run stayed alive to its 900-second bound instead of dying at the title's watchdog (MacBox tests/results/macos-launch-2026-11-25.json).What this changes
held()signal from the pipeline-creation path (and any other host stall that holds a title thread) intohost_posix::Sleep;Sleep(ms >= 100)sleeps in steps, not consuming the requested time whileheld();VICTORY_SLEEP_HOLD=<ms>sets the threshold (0 disables), as XCL does.How it was tested
title_sleep);Sources: MacBox (github.com/aykhanium/MacBox) crates/xcl/src/hle/kernelx.rs:1440-1495, XCL #1288, #509, #232. Comparison note: their stack is CrossOver + D3DMetal; the transferable part is the title-behaviour finding, not the code.
@AnastasisKon on GitHub · 2026-11-28 21:59 UTC · original
/claim
@github-actions[bot] on GitHub · 2026-11-28 21:59 UTC · original
Claimed by @AnastasisKon. Open a draft pull request with
Refs #642in its description within 24 hours, or the claim expires.@AnastasisKon on GitHub · 2026-11-28 22:11 UTC · original
Done — landed on the fork's main as commit 512c43ee (hle(host_posix): hold the host's pipeline-compile time back from the title's Sleep).
Gate green in isolation: cargo test -p victory-hle -p victory -p victory-shader -p victory-gpu -p victory-backend -p xtask, the same suite and cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory (where host_posix compiles; the sleep tests run there), clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -D warnings, cargo xtask policy, all tools/macos/tests/*.sh.
Game run: not possible yet (data still downloading) — this is the step-1 change the issue scoped. What to watch on the next run: whether the 18 s int3 at image+0x4dcbc9d (runs on time, not frames, behind 23k pipeline creations) moves or goes; VICTORY_SLEEP_HOLD=0 restores the old behaviour for A/B. The larger follow-up, async pipeline builds (#647), stays measure-first.