ProjectScarlett: 30 s main-thread watchdog (exe+0x23CF683) at the story intro from cross-queue label-wait deadlocks #215

Open
opened 2026-11-26 07:56:54 +00:00 by github-bot · 0 comments
Owner

@⁠NickStallman on GitHub · 2026-11-26 07:56 UTC · original

On an RTX 5090 (NVIDIA 595.99.02, GE-Proton11-14, main ac4f099 with #212 and #214), ProjectScarlett gets past setup and the story loading screens. It reaches Game State: Game Running: mission 0x98c85f2a, SRL fbk_stry000_FBK_STRY000_INTRO in Prestream. The first world frames render, but at 10–21 s each, and the title then deliberately writes to address 0 at game_scarlett_master.exe+0x23CF683. It happened in all three runs, at frames 18579, 9569 and 4190. This is the same RVA reported in #16 (comment by ReverendOzmund).

What the crash is

It is the title's 30-second main-thread heartbeat watchdog, not a GPU label timeout. "GPU Loc Sig" is only its tag.

  • The watchdog thread is at 0x2215A60 (trampoline 0x2215EA0). It runs Sleep(1000) with QPC and compares the heartbeat at 0x71B6338, which 0x22159F0 writes from the main loop. After 30 unchanged ticks it calls the callback at [0x71B6348] (0x2215C33), then executes mov [0],0. It tolerates a single sleep longer than 2 s, so a debugger pause doesn't trip it.
  • The tag: the per-frame function 0x23CF6A0 installs 0x23CF620 as that callback while it waits for the render thread. The callback decodes "GPU Loc Sig", logs it and writes 0x4D8BD421 to [0].
  • The minidumps (drive_t/*.dmp):
    • The crashing thread's last heartbeat was 29.7 s before the sleep.
    • The main thread is blocked in that render-thread wait (0x23CF735).
    • The render thread is in WaitForSingleObject(INFINITE) on its job handles.

Why frames take 10–30 s

The queues deadlock across each other, and each deadlock is broken only by the memory-wait release in commands/memory_wait.rs (5 s).

  1. TuxBox's own texture publication wait (device/placement.rs, "wait for this batch's texture publication"):
    • The graphics queue is held on this wait.
    • Behind it sits a batch that writes a label a compute queue is waiting for (stalled label … waited by list … type 2 queue … written by list … type 0 queue).
    • Skipping the publication waits in an experiment removed this class of stall entirely.
  2. The remaining cycle: 8 of 10 stalled labels report no submitted or rejected list writes it.
    • Compute queues are held on title labels whose writer list hasn't been submitted.
    • The title can't submit it, because its main and render threads are waiting for GPU progress.
    • On console, a queue wait doesn't hold up the CPU side. Here the per-queue serial wait worker and the cross-queue holds turn it into a CPU↔GPU cycle.
    • With a 1.5 s release instead of 5 s, frames still take 17–21 s and the watchdog still fires.

Prior art

  • xcl ran into both of these:
    • [c4396e2] Every timeout came with the producer queue waiting on xcl's own inserted wait (its texture page-mapping fence). Skipping that wait took CPU releases from 4 to 0–1 per run.
    • [8a5643f] It bridges Write64BitValue / Wait64BitValueX through per-address ID3D12Fences, with GPU Signal at the write and GPU Wait at the wait. It does not poll on the CPU, and it detects and breaks cross-queue cycles when a fence is signalled. It also has bounded CPU and GPU waits, "so a genuinely hung GPU cycle never triggers" the 30 s hang.
  • ztrx 35b054e hit the same 30 s watchdog in this title, from more than 1,200 synchronous pipeline creates on the first world frame. That one is a separate cause, already mitigated here by preparing shaders before launch.

I'm starting on a port of the label-bridging approach and will link it here. Comments are welcome if the memory-wait design has constraints I should keep.

**@⁠NickStallman** on GitHub · 2026-11-26 07:56 UTC · [original](https://github.com/brcly/TuxBox/issues/215) On an RTX 5090 (NVIDIA 595.99.02, GE-Proton11-14, main ac4f099 with #212 and #214), ProjectScarlett gets past setup and the story loading screens. It reaches `Game State: Game Running`: mission `0x98c85f2a`, SRL `fbk_stry000_FBK_STRY000_INTRO` in Prestream. The first world frames render, but at 10–21 s each, and the title then deliberately writes to address 0 at `game_scarlett_master.exe+0x23CF683`. It happened in all three runs, at frames 18579, 9569 and 4190. This is the same RVA reported in #16 (comment by ReverendOzmund). ### What the crash is It is the title's **30-second main-thread heartbeat watchdog**, not a GPU label timeout. "GPU Loc Sig" is only its tag. - **The watchdog thread** is at `0x2215A60` (trampoline `0x2215EA0`). It runs `Sleep(1000)` with QPC and compares the heartbeat at `0x71B6338`, which `0x22159F0` writes from the main loop. After 30 unchanged ticks it calls the callback at `[0x71B6348]` (0x2215C33), then executes `mov [0],0`. It tolerates a single sleep longer than 2 s, so a debugger pause doesn't trip it. - **The tag:** the per-frame function `0x23CF6A0` installs `0x23CF620` as that callback while it waits for the render thread. The callback decodes "GPU Loc Sig", logs it and writes `0x4D8BD421` to `[0]`. - **The minidumps** (`drive_t/*.dmp`): - The crashing thread's last heartbeat was **29.7 s** before the sleep. - The main thread is blocked in that render-thread wait (`0x23CF735`). - The render thread is in `WaitForSingleObject(INFINITE)` on its job handles. ### Why frames take 10–30 s The queues deadlock across each other, and each deadlock is broken only by the memory-wait release in `commands/memory_wait.rs` (5 s). 1. **TuxBox's own texture publication wait** (`device/placement.rs`, "wait for this batch's texture publication"): - The graphics queue is held on this wait. - Behind it sits a batch that writes a label a compute queue is waiting for (`stalled label … waited by list … type 2 queue … written by list … type 0 queue`). - Skipping the publication waits in an experiment removed this class of stall entirely. 2. **The remaining cycle:** 8 of 10 stalled labels report `no submitted or rejected list writes it`. - Compute queues are held on title labels whose writer list hasn't been submitted. - The title can't submit it, because its main and render threads are waiting for GPU progress. - On console, a queue wait doesn't hold up the CPU side. Here the per-queue serial wait worker and the cross-queue holds turn it into a CPU↔GPU cycle. - With a 1.5 s release instead of 5 s, frames still take 17–21 s and the watchdog still fires. ### Prior art - **xcl** ran into both of these: - [c4396e2] Every timeout came with the producer queue waiting on xcl's own inserted wait (its texture page-mapping fence). Skipping that wait took CPU releases from 4 to 0–1 per run. - [8a5643f] It bridges Write64BitValue / Wait64BitValueX through per-address `ID3D12Fence`s, with GPU `Signal` at the write and GPU `Wait` at the wait. It does not poll on the CPU, and it detects and breaks cross-queue cycles when a fence is signalled. It also has bounded CPU and GPU waits, "so a genuinely hung GPU cycle never triggers" the 30 s hang. - **ztrx 35b054e** hit the same 30 s watchdog in this title, from more than 1,200 synchronous pipeline creates on the first world frame. That one is a separate cause, already mitigated here by preparing shaders before launch. I'm starting on a port of the label-bridging approach and will link it here. Comments are welcome if the memory-wait design has constraints I should keep.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 07:56:54 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.