World freezes about 2 minutes in: a job thread spins at image+0x50eb80f, then the watchdog ends the run at image+0x55e56f8 #456

Open
opened 2026-11-27 20:45:41 +00:00 by maaalrey · 11 comments
maaalrey commented 2026-11-27 20:45:41 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-27T20:45:41Z.


Mac

Apple M4 Max, 128 GB, macOS 27.2.1. Apple's Metal Shader Converter 4.0 beta 3 in /usr/local/lib. Series X, windowed, warm shader cache.

Commit

c1b9587 (5 of 5 runs) and 86786a7 (1 run; two more runs there were stopped early by my own guard at a Metal error, which I am looking at separately). Two local changes only: the sound output is replaced by the silent one, and the thread dump prints registers and a few words of title memory.

What happens

New game from an empty data folder, keys scripted through the setup screens. On c1b9587, all five runs:

seconds from start
story packs open 96
world starts (first compute binds) 112-116
last native draws so far line with new draws (logged every 64 frames, so the freeze is somewhat later) 223-248
null write at image+0x2215c35, then 0xc0000005 at image+0x55e56f8 282-283

No GPU error, no command-buffer failure and no host panic in these runs. The fifth run had no thread dump and no extra variables, and ended the same way at 281 s, so the dump is not what triggers the faults. On 86786a7 the same thing: last new draws at 204 s, the two faults at 284 s.

VICTORY_DUMP_THREADS=270 shows the same two threads in the five runs that had a dump:

  • main thread in WaitForSingleObject, title image+ [509898d, 7b5a9d, 21b6d0d, 81269b, 53ec040, 53ebf3a, ...]
  • one thread in title code, image+ [50eb80f..50eb9d1, 31962, 317fd, 25d801b, 221c29c, 2215eca]. The top address moves inside that range from dump to dump; the rest of the chain is the same.

With --console series-s on c1b9587 the freeze did not come: two new-game runs stayed in the world for about 220 s and 380 s (the first ended on my timer, the second at a Metal error). All the runs above are Series X.

Loading an existing story save instead of starting a new game freezes with the same two chains right at world entry (DirectStorage goes quiet at about 83 to 85 thousand requests): 3 of the 3 dumped runs that finished loading on c1b9587. Some earlier runs on that path did get into the world, and the freeze was there with sound on too. On that path Series S froze as well (3 of 3).

What the spinning thread seems to be doing (a guess, from words read in the stopped process; nothing from the game attached)

The loop around image+0x50eb80f probes a hash table (pointer at image+0x876fc50, group count at +0x876fc48) for a 32-bit handle, and it has no exit for "not there". In all six dumps where I printed the table, the handle it looks for is absent and the table holds an entry for the same pool slot with the generation one lower:

run handle looked up entry in the table for that slot
save 0x8801a7 0x4801a7
new game 1 0x1080396 0xc80396
new game 2 0x1880f29 0x1480f29
new game 3 0x2080ede 0x1c80ede
new game 4 0x1c80752 0x1880752
new game, 86786a7 0x10808c0 0xc808c0

In the one dump where I also had the pool's generation word for that slot, it looked like a free-list link (low bits = index + 1), unlike the live slots around it. So my reading is that the job is handed an object that was already freed: it looks up the slot's new handle, never finds it, the main thread waits for that job, and the frame watchdog fires.

I do not know which host behaviour lets the object go while the job still refers to it. I can run a build with more tracing if that helps.

About image+0x55e56f8

#147 was closed with this address as the follow-on of the first-world-frame watchdog. Here the first world frame is fine and a few hundred world frames are presented before the freeze, so this is a second way to reach it.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6654210175 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456). Originally posted by [maaalrey](https://github.com/maaalrey) on 2026-11-27T20:45:41Z. --- ### Mac Apple M4 Max, 128 GB, macOS 27.2.1. Apple's Metal Shader Converter 4.0 beta 3 in /usr/local/lib. Series X, windowed, warm shader cache. ### Commit c1b9587 (5 of 5 runs) and 86786a7 (1 run; two more runs there were stopped early by my own guard at a Metal error, which I am looking at separately). Two local changes only: the sound output is replaced by the silent one, and the thread dump prints registers and a few words of title memory. ### What happens New game from an empty data folder, keys scripted through the setup screens. On c1b9587, all five runs: | | seconds from start | |---|---| | story packs open | 96 | | world starts (first compute binds) | 112-116 | | last `native draws so far` line with new draws (logged every 64 frames, so the freeze is somewhat later) | 223-248 | | null write at image+0x2215c35, then `0xc0000005 at image+0x55e56f8` | 282-283 | No GPU error, no command-buffer failure and no host panic in these runs. The fifth run had no thread dump and no extra variables, and ended the same way at 281 s, so the dump is not what triggers the faults. On 86786a7 the same thing: last new draws at 204 s, the two faults at 284 s. `VICTORY_DUMP_THREADS=270` shows the same two threads in the five runs that had a dump: - main thread in `WaitForSingleObject`, title image+ `[509898d, 7b5a9d, 21b6d0d, 81269b, 53ec040, 53ebf3a, ...]` - one thread **in title code**, image+ `[50eb80f..50eb9d1, 31962, 317fd, 25d801b, 221c29c, 2215eca]`. The top address moves inside that range from dump to dump; the rest of the chain is the same. With `--console series-s` on c1b9587 the freeze did not come: two new-game runs stayed in the world for about 220 s and 380 s (the first ended on my timer, the second at a Metal error). All the runs above are Series X. Loading an existing story save instead of starting a new game freezes with the same two chains right at world entry (DirectStorage goes quiet at about 83 to 85 thousand requests): 3 of the 3 dumped runs that finished loading on c1b9587. Some earlier runs on that path did get into the world, and the freeze was there with sound on too. On that path Series S froze as well (3 of 3). ### What the spinning thread seems to be doing (a guess, from words read in the stopped process; nothing from the game attached) The loop around image+0x50eb80f probes a hash table (pointer at image+0x876fc50, group count at +0x876fc48) for a 32-bit handle, and it has no exit for "not there". In all six dumps where I printed the table, the handle it looks for is absent and the table holds an entry for **the same pool slot with the generation one lower**: | run | handle looked up | entry in the table for that slot | |---|---|---| | save | 0x8801a7 | 0x4801a7 | | new game 1 | 0x1080396 | 0xc80396 | | new game 2 | 0x1880f29 | 0x1480f29 | | new game 3 | 0x2080ede | 0x1c80ede | | new game 4 | 0x1c80752 | 0x1880752 | | new game, 86786a7 | 0x10808c0 | 0xc808c0 | In the one dump where I also had the pool's generation word for that slot, it looked like a free-list link (low bits = index + 1), unlike the live slots around it. So my reading is that the job is handed an object that was already freed: it looks up the slot's new handle, never finds it, the main thread waits for that job, and the frame watchdog fires. I do not know which host behaviour lets the object go while the job still refers to it. I can run a build with more tracing if that helps. ### About image+0x55e56f8 #147 was closed with this address as the follow-on of the first-world-frame watchdog. Here the first world frame is fine and a few hundred world frames are presented before the freeze, so this is a second way to reach it.
alexballvideos-netizen commented 2026-11-27 21:38:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by alexballvideos-netizen on 2026-11-27T21:38:01Z.


A static reading of the spinning loop, from my own copy of the exe. It supports your guess and narrows it. No code quoted, just what it does.

  • The table at image+0x876fc48/50 is an open-addressing map with 16-byte control groups (SwissTable-style: groups of 0x90 bytes, 16 tag bytes, then 16 entries of 8 bytes). The loop at image+0x50eb80f probes group after group and only stops on a match. There's no empty-slot check, so a missing key spins forever, exactly as you saw.
  • The key isn't passed in. It's rebuilt from the object pointer at lookup time: pool slot index = (pointer − pool base) / stride, the pool's id in bits 17–21, and the generation read from the pool's generation array right now, in bits 22 and up. The pool descriptor comes from a small table indexed by the pool id. Base, stride and the generation array are at +0, +8 and +0x28.
  • So if the slot is freed after the object was put in the table, the generation word changes. You saw it change to a free-list link, which apparently carries generation + 1. The rebuilt key is then exactly "the same slot, generation + 1" and is never found. That matches all six of your rows.

Conclusion: the job still holds a pointer to an object that another path has already freed (not reallocated). The bug is the ordering between that free and the job, not the table.

Other users of the same table, for whoever traces it next:

  • inserts: around image+0x554f7e8 (it bumps the count at +0x876fc4c)
  • clears or resets: image+0x55bfc0d and image+0x354fc65
  • other lookups: image+0x4f13ae1, image+0x56c6341, image+0x55bfa12, image+0x354fb64

Reproduction on an M3 Max, 36 GB, Series X:

  • 1 of 6 runs hit the 0x2215c35 fault, at about 270 s. That run was main b998bb65 with VICTORY_DEPTH_TWINS=0.
  • A 480 s run on main with default settings stayed in the world to the timer. Its frame counter went 2048 → 2496 in about 6 minutes, so the freeze needs more world frames than this Mac reaches in 300 s.
  • That may be why your faster M4 Max hits it every time.

A next step that would name the freeing path is a write watch on the generation word of the slot the job holds. I don't have one yet. If you can catch the slot early (with your thread-dump build), a VICTORY_FIND_QWORD on the object pointer, taken while it's still live, would show which other structures still point at it.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7228619149 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7228619149). Originally posted by [alexballvideos-netizen](https://github.com/alexballvideos-netizen) on 2026-11-27T21:38:01Z. --- A static reading of the spinning loop, from my own copy of the exe. It supports your guess and narrows it. No code quoted, just what it does. - The table at image+0x876fc48/50 is an open-addressing map with 16-byte control groups (SwissTable-style: groups of 0x90 bytes, 16 tag bytes, then 16 entries of 8 bytes). The loop at image+0x50eb80f probes group after group and only stops on a match. There's no empty-slot check, so a missing key spins forever, exactly as you saw. - **The key isn't passed in. It's rebuilt from the object pointer at lookup time:** pool slot index = (pointer − pool base) / stride, the pool's id in bits 17–21, and the generation **read from the pool's generation array right now**, in bits 22 and up. The pool descriptor comes from a small table indexed by the pool id. Base, stride and the generation array are at +0, +8 and +0x28. - So if the slot is freed after the object was put in the table, the generation word changes. You saw it change to a free-list link, which apparently carries generation + 1. The rebuilt key is then exactly "the same slot, generation + 1" and is never found. That matches all six of your rows. **Conclusion:** the job still holds a pointer to an object that another path has already **freed** (not reallocated). The bug is the ordering between that free and the job, not the table. **Other users of the same table, for whoever traces it next:** - inserts: around image+0x554f7e8 (it bumps the count at +0x876fc4c) - clears or resets: image+0x55bfc0d and image+0x354fc65 - other lookups: image+0x4f13ae1, image+0x56c6341, image+0x55bfa12, image+0x354fb64 **Reproduction on an M3 Max, 36 GB, Series X:** - 1 of 6 runs hit the `0x2215c35` fault, at about 270 s. That run was main b998bb65 with `VICTORY_DEPTH_TWINS=0`. - A 480 s run on main with default settings stayed in the world to the timer. Its frame counter went 2048 → 2496 in about 6 minutes, so the freeze needs more world frames than this Mac reaches in 300 s. - That may be why your faster M4 Max hits it every time. A next step that would name the freeing path is a write watch on the generation word of the slot the job holds. I don't have one yet. If you can catch the slot early (with your thread-dump build), a `VICTORY_FIND_QWORD` on the object pointer, taken while it's still live, would show which other structures still point at it.
derz92 commented 2026-11-27 21:41:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T21:41:12Z.


A data point that may name the cause: on this Mac, this freeze goes away with texture copy-back.

M5 Max, 36 GB, macOS 26.5, Series S, warm cache, tree b998bb65 + #437 (+ #358) with #437's switches.

  • Without copy-back: 2 of 2 runs froze in the prologue cutscene, at frame about 1490 and about 1570. Thread dump at 200 s: the main thread in WaitForSingleObject at [509898d, 7b5a9d, 21b6d0d, 81269b, 53ec040, 53ebf3a, ...] (your stack), and one thread in title code at [50eb823, 31962, 317fd, 25d801b, 221c29c, 2215eca]. That's your spinning loop.
  • With VICTORY_TEXTURE_BACK=1: 0 of 7 runs froze. One copied back everything (274 textures). Six copied back only textures of 8 KiB or less (a local size limit in write_back; 51 copied, 214 skipped). Each played through the cutscene to the player-control prompt and kept presenting to its 200 to 360 s world cap (frames 1850 to 1990).

The cold-cache run without copy-back also got past it, but that's the slower run, consistent with @alexballvideos-netizen's point that the freeze needs enough world frames.

Reading it together with the static analysis above: the title may decide an object can be freed, or that a job's object is still live, from a small GPU-written result it reads on the CPU. Without copy-back that read sees stale bytes, the free happens out of order, and the job later rebuilds a key with generation + 1. The small textures copied back in the passing runs were 1x1 (format 3, 256 B), 54x30, 27x15 and 20x12 (format 42), 10x6 (format 2) and similar. I haven't yet narrowed it to one texture. Bisecting the size limit, or logging which of these the title reads just before the free, would name it. #449 (copy-back by default) would cover this, but on this Mac full copy-back also brings visible block noise (details on #449), so a small-texture limit currently gives both the progress and a clean image.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7228665333 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7228665333). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T21:41:12Z. --- A data point that may name the cause: on this Mac, this freeze goes away with texture copy-back. M5 Max, 36 GB, macOS 26.5, Series S, warm cache, tree b998bb65 + #437 (+ #358) with #437's switches. - **Without copy-back: 2 of 2 runs froze** in the prologue cutscene, at frame about 1490 and about 1570. Thread dump at 200 s: the main thread in `WaitForSingleObject` at `[509898d, 7b5a9d, 21b6d0d, 81269b, 53ec040, 53ebf3a, ...]` (your stack), and one thread in title code at `[50eb823, 31962, 317fd, 25d801b, 221c29c, 2215eca]`. That's your spinning loop. - **With `VICTORY_TEXTURE_BACK=1`: 0 of 7 runs froze.** One copied back everything (274 textures). Six copied back only textures of **8 KiB or less** (a local size limit in `write_back`; 51 copied, 214 skipped). Each played through the cutscene to the player-control prompt and kept presenting to its 200 to 360 s world cap (frames 1850 to 1990). The cold-cache run without copy-back also got past it, but that's the slower run, consistent with @alexballvideos-netizen's point that the freeze needs enough world frames. Reading it together with the static analysis above: the title may decide an object can be freed, or that a job's object is still live, from a small GPU-written result it reads on the CPU. Without copy-back that read sees stale bytes, the free happens out of order, and the job later rebuilds a key with generation + 1. The small textures copied back in the passing runs were 1x1 (format 3, 256 B), 54x30, 27x15 and 20x12 (format 42), 10x6 (format 2) and similar. I haven't yet narrowed it to one texture. Bisecting the size limit, or logging which of these the title reads just before the free, would name it. #449 (copy-back by default) would cover this, but on this Mac full copy-back also brings visible block noise (details on #449), so a small-texture limit currently gives both the progress and a clean image.
derz92 commented 2026-11-27 21:54:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T21:54:46Z.


Correction to my count above. One of the seven copy-back runs (8 KiB limit) also stopped presenting, at frame about 1478 (74 s into a 205 s run), the same place as the runs without copy-back. So it's 1 of 7 with copy-back vs 2 of 2 without, not 0 of 7. Another of the seven only reached frame about 1690 before its cap, not 1850+.

Those seven runs also weren't one controlled condition. They used four different builds (some with extra frame timers, which slow the title down), all came after the two control runs, and copy-back itself adds GPU-to-CPU syncs. So copy-back may only change timing, not supply the missing data, and I can't claim it as the cause yet. Next I'll alternate one binary with copy-back on and off, warm cache, several runs each, before saying more.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7228863984 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7228863984). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T21:54:46Z. --- Correction to my count above. One of the seven copy-back runs (8 KiB limit) **also stopped presenting**, at frame about 1478 (74 s into a 205 s run), the same place as the runs without copy-back. So it's **1 of 7 with copy-back vs 2 of 2 without**, not 0 of 7. Another of the seven only reached frame about 1690 before its cap, not 1850+. Those seven runs also weren't one controlled condition. They used four different builds (some with extra frame timers, which slow the title down), all came after the two control runs, and copy-back itself adds GPU-to-CPU syncs. So copy-back may only change timing, not supply the missing data, and I can't claim it as the cause yet. Next I'll alternate one binary with copy-back on and off, warm cache, several runs each, before saying more.
derz92 commented 2026-11-27 22:16:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T22:16:44Z.


Result of the controlled run I promised. On this Mac, copy-back makes no difference to the freeze.

The setup:

  • One binary: b998bb65 + #437 + #358, plus two local mirror speed-ups that took a world frame from about 520 to 410 ms.
  • Identical switches throughout, with only VICTORY_TEXTURE_BACK alternating 1/0.
  • Warm cache, Series S, 180 s in the world per run.
copy-back runs froze frames presented
on (8 KiB limit) 3 0 1611, 1785, 1784
off 3 0 1667, 1755, 1770

All six kept presenting to the cap. So the three freezes I saw earlier at frame about 1480 to 1570 (two without copy-back, one with) came from older, slower builds of the same tree. I withdraw the copy-back hypothesis from my first comment. What's left fits your point that the freeze depends on timing: none in 6 runs of the faster build, 3 in about 9 runs of slower builds. I'll keep logging any freeze here, with its stack.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7229187056 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7229187056). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T22:16:44Z. --- Result of the controlled run I promised. **On this Mac, copy-back makes no difference to the freeze.** The setup: - One binary: b998bb65 + #437 + #358, plus two local mirror speed-ups that took a world frame from about 520 to 410 ms. - Identical switches throughout, with only `VICTORY_TEXTURE_BACK` alternating 1/0. - Warm cache, Series S, 180 s in the world per run. | copy-back | runs | froze | frames presented | |---|---|---|---| | on (8 KiB limit) | 3 | 0 | 1611, 1785, 1784 | | off | 3 | 0 | 1667, 1755, 1770 | All six kept presenting to the cap. So the three freezes I saw earlier at frame about 1480 to 1570 (two without copy-back, one with) came from older, slower builds of the same tree. I withdraw the copy-back hypothesis from my first comment. What's left fits your point that the freeze depends on timing: none in 6 runs of the faster build, 3 in about 9 runs of slower builds. I'll keep logging any freeze here, with its stack.
derz92 commented 2026-11-27 23:29:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T23:29:47Z.


More data on where it happens. Across tonight's runs on this Mac (#437's tree plus local speed changes, Series S, warm cache, 180–300 s world caps), there were 6 freezes. Every one stopped presenting at frame 1478–1573:

run last frame presented build state
A ~1493 #437 as is
B ~1573 #437 as is
C ~1478 + mirror diagnostics, copy-back on
D ~1504 + mirror fixes, probes per submission
E ~1505 + mirror fixes, probes per frame
F ~1550 + mirror fixes, probes per frame, lock skip on

About 20 other runs passed that point and kept presenting to their caps (frame 1600–2300). These frozen runs were at very different speeds: frame times of about 400 to 520 ms, and both cold and warm caches. Yet the frame number barely moves, so it seems tied to one moment in the cutscene (just after it starts) rather than to elapsed world time or total frame count. A race that only that moment exposes would fit your freed-slot reading. Roughly 1 run in 4 hits it here.

If anyone has a write-watch build for the slot's generation word, the window to arm it is narrow and predictable: from about frame 1450 to 1600.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7230184991 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7230184991). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T23:29:47Z. --- More data on where it happens. Across tonight's runs on this Mac (#437's tree plus local speed changes, Series S, warm cache, 180–300 s world caps), there were **6 freezes**. Every one stopped presenting at **frame 1478–1573**: | run | last frame presented | build state | |---|---|---| | A | ~1493 | #437 as is | | B | ~1573 | #437 as is | | C | ~1478 | + mirror diagnostics, copy-back on | | D | ~1504 | + mirror fixes, probes per submission | | E | ~1505 | + mirror fixes, probes per frame | | F | ~1550 | + mirror fixes, probes per frame, lock skip on | About 20 other runs passed that point and kept presenting to their caps (frame 1600–2300). These frozen runs were at very different speeds: frame times of about 400 to 520 ms, and both cold and warm caches. Yet the frame number barely moves, so it seems tied to **one moment in the cutscene** (just after it starts) rather than to elapsed world time or total frame count. A race that only that moment exposes would fit your freed-slot reading. Roughly 1 run in 4 hits it here. If anyone has a write-watch build for the slot's generation word, the window to arm it is narrow and predictable: from about frame 1450 to 1600.
maaalrey commented 2026-11-28 01:50:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-28T01:50:41Z.


Thanks both. An update on current main + #459: the freeze is still there when loading a save, which is a faster way to get it; what the stuck threads hold; and what the sampled frees look like.

M4 Max, 128 GB, macOS 27.2.1, Series S, windowed. Builds: b998bb65 and 86cefd22, with #459 unless noted, plus local dump-only changes.

Still there with #459, and loading a save gets it quickly

New game from an empty data folder: no freeze in two 600 s runs on b998bb65 (with and without #459), about 800 world frames each at 1.8 to 2.0 fps.

Loading an existing story save instead, 28 runs:

build runs stuck on the loading screen in the world
b998bb65 + #459 8 6 2
86cefd22 + #459 20 12 8
  • A stuck run goes quiet about 65 s in, after 74 to 78 thousand DirectStorage requests. A run that loads takes 101 to 108 thousand and is in the world at 94 to 124 s.
  • The loading screen keeps presenting at 30 fps and there is no watchdog fault in up to 260 s of stall, so on this path it never reaches the watchdog's image+0x2215c35 and image+0x55e56f8.
  • 17 of the 18 stuck runs had a thread dump, and all 17 show the chain image+ [50eb823, 31962, 317fd, 25d801b, 221c29c, 2215eca]. In 8 of the 17 two threads are in it at once, each on a different object of pool 4.
  • The rate is not steady: on 86cefd22 the first 6 runs all stuck, then 8 of the next 14 loaded. I do not know what changed in between.

What the spinning threads hold

In 12 of the stuck runs the dump also read the slot of each object a spinning thread holds (16 objects). All 16 read the same way:

  • the slot's generation entry (32-bit: the generation from bit 17, the low 17 bits a link) holds generation 2 and a link to another slot, where the live entries around it hold generation 1 with the low bits all set;
  • the table has exactly one entry for that slot, with generation 1 (for example handle 0x480eab for slot 0xeab of pool 4, while the lookup asks for 0x880eab);
  • the object's first qword is still its method table.

So I read each object as registered at generation 1 and freed since, which matches alexballvideos's reading. On the scan alexballvideos asked about: I ran VICTORY_FIND_QWORD's scan on the objects at dump time, not while they were live, and it finds each still referenced from many arrays of pool-4 siblings.

Which code frees them

A write watch on the whole pages of pool 4's generation entries, armed at 35 s, in two of the stuck runs. It samples (the page stays open for a moment after each hit, so most writes are missed). I am reading a write to an entry whose low bits are all set as a free. Those came from job tasks only, on these chains, image+:

  • [51f2b5b, 51f216d, 22a2379, 63e78, 4eaa05a, 221c29c, 2215eca] (most)
  • [51f2b5b, 51f216d, 22a2379, 63e78, 25703c4, 221c29c, 2215eca]
  • [51f2b5b, 51f216d, 33687e, 3366da, 21f26b9, 63e78, 4eaa05a, 221c29c, 2215eca]

All writes to those pages stop within a second of the stall. The watch did not catch the free of the exact slots the spinners hold (27 and 34 frees sampled in the two runs). So as far as this shows: job tasks (most through image+0x22a2379) free pool-4 objects while another (through image+0x25d801b) still looks them up. What orders them on real hardware I do not know.

One thing that did not explain it

The host reports the Mac's processor count (16 here) to the title, and SetThreadPriority and the affinity calls do nothing. With a local switch for the reported count, on 86cefd22: 16 → 1 of 8 loaded, 8 → 5 of 9, 4 → 2 of 3. But 5 of the 8 runs at 16 were among the first 6, and in the alternating runs at the end it was 1 of 3 at 16 against 1 of 2 at 8, so I cannot separate it from the drift above. Not a fix either way; the thread dump has 58 threads at every count.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7231954955 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7231954955). Originally posted by [maaalrey](https://github.com/maaalrey) on 2026-11-28T01:50:41Z. --- Thanks both. An update on current main + #459: the freeze is still there when loading a save, which is a faster way to get it; what the stuck threads hold; and what the sampled frees look like. M4 Max, 128 GB, macOS 27.2.1, Series S, windowed. Builds: b998bb65 and 86cefd22, with #459 unless noted, plus local dump-only changes. ### Still there with #459, and loading a save gets it quickly New game from an empty data folder: no freeze in two 600 s runs on b998bb65 (with and without #459), about 800 world frames each at 1.8 to 2.0 fps. Loading an existing story save instead, 28 runs: | build | runs | stuck on the loading screen | in the world | |---|---|---|---| | b998bb65 + #459 | 8 | 6 | 2 | | 86cefd22 + #459 | 20 | 12 | 8 | - A stuck run goes quiet about 65 s in, after 74 to 78 thousand DirectStorage requests. A run that loads takes 101 to 108 thousand and is in the world at 94 to 124 s. - The loading screen keeps presenting at 30 fps and there is **no watchdog fault** in up to 260 s of stall, so on this path it never reaches the watchdog's image+0x2215c35 and image+0x55e56f8. - 17 of the 18 stuck runs had a thread dump, and all 17 show the chain image+ [50eb823, 31962, 317fd, 25d801b, 221c29c, 2215eca]. In 8 of the 17 **two** threads are in it at once, each on a different object of pool 4. - The rate is not steady: on 86cefd22 the first 6 runs all stuck, then 8 of the next 14 loaded. I do not know what changed in between. ### What the spinning threads hold In 12 of the stuck runs the dump also read the slot of each object a spinning thread holds (16 objects). All 16 read the same way: - the slot's generation entry (32-bit: the generation from bit 17, the low 17 bits a link) holds generation 2 and a link to another slot, where the live entries around it hold generation 1 with the low bits all set; - the table has exactly one entry for that slot, with generation 1 (for example handle 0x480eab for slot 0xeab of pool 4, while the lookup asks for 0x880eab); - the object's first qword is still its method table. So I read each object as registered at generation 1 and freed since, which matches alexballvideos's reading. On the scan alexballvideos asked about: I ran `VICTORY_FIND_QWORD`'s scan on the objects at dump time, not while they were live, and it finds each still referenced from many arrays of pool-4 siblings. ### Which code frees them A write watch on the whole pages of pool 4's generation entries, armed at 35 s, in two of the stuck runs. It samples (the page stays open for a moment after each hit, so most writes are missed). I am reading a write to an entry whose low bits are all set as a free. Those came from job tasks only, on these chains, image+: - [51f2b5b, 51f216d, 22a2379, 63e78, 4eaa05a, 221c29c, 2215eca] (most) - [51f2b5b, 51f216d, 22a2379, 63e78, 25703c4, 221c29c, 2215eca] - [51f2b5b, 51f216d, 33687e, 3366da, 21f26b9, 63e78, 4eaa05a, 221c29c, 2215eca] All writes to those pages stop within a second of the stall. The watch did not catch the free of the exact slots the spinners hold (27 and 34 frees sampled in the two runs). So as far as this shows: job tasks (most through image+0x22a2379) free pool-4 objects while another (through image+0x25d801b) still looks them up. What orders them on real hardware I do not know. ### One thing that did not explain it The host reports the Mac's processor count (16 here) to the title, and `SetThreadPriority` and the affinity calls do nothing. With a local switch for the reported count, on 86cefd22: 16 → 1 of 8 loaded, 8 → 5 of 9, 4 → 2 of 3. But 5 of the 8 runs at 16 were among the first 6, and in the alternating runs at the end it was 1 of 3 at 16 against 1 of 2 at 8, so I cannot separate it from the drift above. Not a fix either way; the thread dump has 58 threads at every count.
maaalrey commented 2026-11-28 02:31:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-28T02:31:16Z.


Results on main 8efcff13 (which has #499 and #459; plus local dump-only changes), same Mac and settings as above (Series S, windowed, loading the same story save):

build runs stuck on the loading screen in the world
86cefd22 + #459 (no #499) 20 12 8
8efcff13 (with #499) 4 4 0

All four have the same chain in the dump, image+ [first frame between 50eb80f and 50eb82c, then 31962, 317fd, 25d801b, 221c29c, 2215eca], on 2, 2, 1 and 1 threads. Four runs cannot say whether the rate changed; they do show the freeze still happens on a build that has #499.

Two more observations from 86cefd22, from two further stuck runs (not the two write-watch runs of my earlier comment) that had both the write watch and a local trace of what the title asks for each thread:

  • The title sets a priority, a group affinity mask or both on 54 of the 58 threads in the dump, often before the thread first runs. Its 13 job workers all ask for priority 2: eight with mask 0xff and five with mask 0x1f00. Five other threads ask for priority 0 with the same mask 0x1f00. The host does nothing with either call (SetThreadPriority, SetThreadGroupAffinity).
  • In each of the two runs the one spinning thread was one of the five priority-2, mask-0x1f00 job workers, and every sampled write that I read as a free of a pool-4 object (33 and 32 of them) came from the mask-0xff workers. In the same dumps one mask-0xff worker sits in WaitForSingleObject under a job, image+ [55bfc39, 3d75259, 63e78, 4eaa05a, 221c29c, 2215eca], and the main thread waits at image+ [509898d, 7b5a9d, 21b6d0d, 81269b]. Two runs, so an observation, not a finding.

My reading of those two waits (a guess): the function that contains image+0x55bfc39 is the one that empties the table from my earlier comment, and it waits for the lookup jobs to finish first; so once a lookup spins on a freed object, that job and the main thread behind it wait indefinitely (up to the 260 s I watched). I still do not know what keeps the freeing job behind the lookups on real hardware.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7232417419 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7232417419). Originally posted by [maaalrey](https://github.com/maaalrey) on 2026-11-28T02:31:16Z. --- Results on main 8efcff13 (which has #499 and #459; plus local dump-only changes), same Mac and settings as above (Series S, windowed, loading the same story save): | build | runs | stuck on the loading screen | in the world | |---|---|---|---| | 86cefd22 + #459 (no #499) | 20 | 12 | 8 | | 8efcff13 (with #499) | 4 | 4 | 0 | All four have the same chain in the dump, image+ [first frame between 50eb80f and 50eb82c, then 31962, 317fd, 25d801b, 221c29c, 2215eca], on 2, 2, 1 and 1 threads. Four runs cannot say whether the rate changed; they do show the freeze still happens on a build that has #499. Two more observations from 86cefd22, from two further stuck runs (not the two write-watch runs of my earlier comment) that had both the write watch and a local trace of what the title asks for each thread: - The title sets a priority, a group affinity mask or both on 54 of the 58 threads in the dump, often before the thread first runs. Its 13 job workers all ask for priority 2: eight with mask 0xff and five with mask 0x1f00. Five other threads ask for priority 0 with the same mask 0x1f00. The host does nothing with either call (`SetThreadPriority`, `SetThreadGroupAffinity`). - In each of the two runs the one spinning thread was one of the five priority-2, mask-0x1f00 job workers, and every sampled write that I read as a free of a pool-4 object (33 and 32 of them) came from the mask-0xff workers. In the same dumps one mask-0xff worker sits in `WaitForSingleObject` under a job, image+ [55bfc39, 3d75259, 63e78, 4eaa05a, 221c29c, 2215eca], and the main thread waits at image+ [509898d, 7b5a9d, 21b6d0d, 81269b]. Two runs, so an observation, not a finding. My reading of those two waits (a guess): the function that contains image+0x55bfc39 is the one that empties the table from my earlier comment, and it waits for the lookup jobs to finish first; so once a lookup spins on a freed object, that job and the main thread behind it wait indefinitely (up to the 260 s I watched). I still do not know what keeps the freeing job behind the lookups on real hardware.
derz92 commented 2026-11-28 03:28:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T03:28:23Z.


A lead on what the race involves: dropping two compute shaders' dispatches makes this freeze much more likely.

Setup: lit-world/base-3 plus local speed changes, M5 Max, macOS 26.5, Series S, warm cache, #437's switches. I alternated the same binary with and without VICTORY_SKIP_PIPELINES=6a04b371a8e26853,7de0f9db96ddd295 (#535). Those are two compute programs that run as long chains in the world, hundreds of dispatches a pass. Each run had a 150 s world cap.

runs froze (stopped presenting at frame 1484–1516)
with the skip 4 3
without 4 1

Pooled with the night's other runs on this base: 7 of 11 froze with the skip, 2 of 10 without. Every freeze stopped in the same window as before (frames ~1470–1520), with the same main-thread wait.

It's a lead, not a proof: the sample is small, and timing changes too (skipping makes frames about 10% cheaper). Still, if the job's object is freed out of order when work tied to those two programs doesn't run, their outputs (or the fences around them) may be part of what the title waits on before the free. If someone has a write-watch build for the slot's generation word, VICTORY_SKIP_PIPELINES=6a04b371a8e26853,7de0f9db96ddd295 should make the freeze come up about three runs in four here.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7233099236 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7233099236). Originally posted by [derz92](https://github.com/derz92) on 2026-11-28T03:28:23Z. --- A lead on what the race involves: **dropping two compute shaders' dispatches makes this freeze much more likely.** Setup: `lit-world/base-3` plus local speed changes, M5 Max, macOS 26.5, Series S, warm cache, #437's switches. I alternated the same binary with and without `VICTORY_SKIP_PIPELINES=6a04b371a8e26853,7de0f9db96ddd295` (#535). Those are two compute programs that run as long chains in the world, hundreds of dispatches a pass. Each run had a 150 s world cap. | | runs | froze (stopped presenting at frame 1484–1516) | |---|---|---| | with the skip | 4 | 3 | | without | 4 | 1 | Pooled with the night's other runs on this base: **7 of 11 froze with the skip, 2 of 10 without.** Every freeze stopped in the same window as before (frames ~1470–1520), with the same main-thread wait. It's a lead, not a proof: the sample is small, and timing changes too (skipping makes frames about 10% cheaper). Still, if the job's object is freed out of order when work tied to those two programs doesn't run, their outputs (or the fences around them) may be part of what the title waits on before the free. If someone has a write-watch build for the slot's generation word, `VICTORY_SKIP_PIPELINES=6a04b371a8e26853,7de0f9db96ddd295` should make the freeze come up about three runs in four here.
maaalrey commented 2026-11-28 04:05:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-28T04:05:27Z.


/claim

A workaround for the freeze in the lookup loop, on my setup. I am claiming the issue to put it up as an opt-in switch in a draft PR; the claim covers the switch only, not the cause, which is still open for anyone.

The loop the stuck threads sit in (image+0x50eb80f) searches the table group by group and has no way out for a handle that is in no group. Locally I gave it one. Before the title runs, the first byte of the loop's "not in this group, try the next" path (image+0x50eb9d1) becomes an int3. The handler then does what that path did, unless the group just searched has a free slot (a control byte with bit 7 set); in that case it returns through the function's own exit (image+0x50eb910), which the function already takes for an object with nothing to draw. Nothing is patched unless the code at that place is the counter step and the jump back that I expect.

Same Mac, save and settings as in my earlier comments (Series S, windowed, same story save), main 8efcff13:

variant runs stuck on the loading screen in the world within 260 s
as it is 4 4 0
with the exit 10 0 9
  • The tenth run with the exit had not reached the world when I stopped it at 260 s. It was past the point where runs stick (90 thousand DirectStorage requests, against 74 to 78 thousand in stuck runs), and its dump has no thread in the lookup.
  • The exit was taken in 8 of the 10 runs: 10 times in seven of them and 20 times in the tenth run above, 90 in all, each time for a pool-4 handle with generation 2. In the two runs where it was never taken the save loaded.
  • No thread is in the lookup loop in any of the ten thread dumps.
  • World frames afterwards: 1.3 to 1.7 fps mean per run. I have no in-world rate on this build without the exit to compare with.
  • One new-game run of 480 s with the exit on reached the world and never took it.

Four baseline runs are few; 0 stuck of 10 against 4 of 4 here and 12 of 20 on the build before is why I am putting it up.

What it does not do: it does not touch the cause, which I still do not know. As I read it, a freed object is skipped for that frame; I have not checked what else that early return skips, and I have not looked for anything missing on screen. "A group with a free slot ends the search" is a guess, from the insert (image+0x554f7e0) taking the first free slot it meets on the same search path.

The switch will be VICTORY_LOOKUP_EXIT=1, off by default, with the offsets marked as this build's only, tests, and a note in docs/native-host.md. Once the draft PR is up: derz92, alexballvideos, if you can run it on your freezing setups, the log prints a line each time the exit is taken, and whether any run still stops would tell us whether the new-game freeze is the same thing.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7233677149 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7233677149). Originally posted by [maaalrey](https://github.com/maaalrey) on 2026-11-28T04:05:27Z. --- /claim A workaround for the freeze in the lookup loop, on my setup. I am claiming the issue to put it up as an opt-in switch in a draft PR; the claim covers the switch only, not the cause, which is still open for anyone. The loop the stuck threads sit in (image+0x50eb80f) searches the table group by group and has no way out for a handle that is in no group. Locally I gave it one. Before the title runs, the first byte of the loop's "not in this group, try the next" path (image+0x50eb9d1) becomes an `int3`. The handler then does what that path did, unless the group just searched has a free slot (a control byte with bit 7 set); in that case it returns through the function's own exit (image+0x50eb910), which the function already takes for an object with nothing to draw. Nothing is patched unless the code at that place is the counter step and the jump back that I expect. Same Mac, save and settings as in my earlier comments (Series S, windowed, same story save), main 8efcff13: | variant | runs | stuck on the loading screen | in the world within 260 s | |---|---|---|---| | as it is | 4 | 4 | 0 | | with the exit | 10 | 0 | 9 | - The tenth run with the exit had not reached the world when I stopped it at 260 s. It was past the point where runs stick (90 thousand DirectStorage requests, against 74 to 78 thousand in stuck runs), and its dump has no thread in the lookup. - The exit was taken in 8 of the 10 runs: 10 times in seven of them and 20 times in the tenth run above, 90 in all, each time for a pool-4 handle with generation 2. In the two runs where it was never taken the save loaded. - No thread is in the lookup loop in any of the ten thread dumps. - World frames afterwards: 1.3 to 1.7 fps mean per run. I have no in-world rate on this build without the exit to compare with. - One new-game run of 480 s with the exit on reached the world and never took it. Four baseline runs are few; 0 stuck of 10 against 4 of 4 here and 12 of 20 on the build before is why I am putting it up. What it does not do: it does not touch the cause, which I still do not know. As I read it, a freed object is skipped for that frame; I have not checked what else that early return skips, and I have not looked for anything missing on screen. "A group with a free slot ends the search" is a guess, from the insert (image+0x554f7e0) taking the first free slot it meets on the same search path. The switch will be `VICTORY_LOOKUP_EXIT=1`, off by default, with the offsets marked as this build's only, tests, and a note in docs/native-host.md. Once the draft PR is up: derz92, alexballvideos, if you can run it on your freezing setups, the log prints a line each time the exit is taken, and whether any run still stops would tell us whether the new-game freeze is the same thing.
github-actions[bot] commented 2026-11-28 04:05:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T04:05:37Z.


Claimed by @maaalrey. Open a draft pull request with Refs #456 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7233680338 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7233680338). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T04:05:37Z. --- Claimed by @maaalrey. Open a draft pull request with `Refs #456` in its description within 24 hours, or the claim expires.
maaalrey commented 2026-11-28 05:20:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-28T05:20:05Z.


The draft is up: #565, on main 2f4d81e0.

To try it: build that branch and run with VICTORY_LOOKUP_EXIT=1. The log then has VICTORY_LOOKUP_EXIT: armed at image+0x50eb9d1 near the start, and a warning line a lookup met an empty entry before its handle; it returns each time the exit is taken (the first eight, then at powers of two, with the handle and the counts so far). If it says not armed, the code at that place is not the one I patched and nothing was changed.

Since the claim comment, two things changed in review: the search now ends only at a control byte of exactly 0x80 (the value the emptying job writes), where my local version ended at any byte with bit 7 set, and the page gets its old protection back. Four more runs on that code: 4 of 4 in the world, three of them with exits, one without needing any.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7234603885 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/456#issuecomment-7234603885). Originally posted by [maaalrey](https://github.com/maaalrey) on 2026-11-28T05:20:05Z. --- The draft is up: #565, on main 2f4d81e0. To try it: build that branch and run with `VICTORY_LOOKUP_EXIT=1`. The log then has `VICTORY_LOOKUP_EXIT: armed at image+0x50eb9d1` near the start, and a warning line `a lookup met an empty entry before its handle; it returns` each time the exit is taken (the first eight, then at powers of two, with the handle and the counts so far). If it says `not armed`, the code at that place is not the one I patched and nothing was changed. Since the claim comment, two things changed in review: the search now ends only at a control byte of exactly 0x80 (the value the emptying job writes), where my local version ended at any byte with bit 7 set, and the page gets its old protection back. Four more runs on that code: 4 of 4 in the world, three of them with exits, one without needing any.
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
LakshanSivakumar/Native-Victory-macOS#456
No description provided.