Paw Patrol: Grand Prix (PPSA05521) — startup spins in a codepoint-enumeration loop whose bound is a live-read shared counter
Boots into native execution (743K relocations, 2484 import stubs resolved) but never reaches the menu — the import-loop guard force-exits it after ~12.5M consecutive calls to scePthreadMutexLock within its 5-second window.
What's actually happening, traced via the new guest stack-walk diagnostic (#874) and manual disassembly of the resulting call chain:
- A static constructor (part of
.init_array, run beforemain) calls a function at what resolves to aVec-style growth routine. That routine loopsfor i in 0..count { encode_utf8(i); insert_into_collection(result) }— encoding successive integers as UTF-8 (the0xFF/0xFFFF/0xFFFFFFbranches are the standard 1/2/3/4-byte UTF-8 length thresholds, i.e. Unicode codepoint encoding) and inserting each into a table guarded by the same adaptive mutex documented in earlier comments on #873. - Critically,
count([r15+8]) is re-read from memory on every iteration rather than cached once at loop entry. - The mutex/hash-table operations themselves are correct and uncontended every time they're checked (
SHARPEMU_LOG_PTHREADS=1shows cleanlock→unlockpairs, no stuck owner).
Put together: this isn't a deadlock or a missing HLE export — it's a loop whose termination bound is being mutated (very plausibly by the very act of inserting each new item) faster than the loop can converge, or forever. Whether that's a genuine bug in the shipped title's/engine's code or an emulation timing/ordering difference exposing a race that's normally harmless on real hardware, I can't determine without tracing what actually increments the counter — that needs the per-instruction stepping design being discussed in #873.
Reproduction: any run of the retail eboot reaches this within a few seconds of boot, 100% reproducible. Log excerpt and full disassembly trail available on request.
Re-tested on current main (dfb7efa, includes #877/#880/#881). Good news: the codepoint-enumeration spin described above no longer reproduces — the title now gets well past that point, resolves imports, and reaches real Vulkan rendering with the guest's own audio playing (confirmed audibly during a run). Whichever of the recent stall/import-loop-guard or AGC fixes did it, this specific original blocker looks resolved.
It doesn't reach a playable state yet, though — 2 new things show up past that point, both of which are already being tracked elsewhere as apparently generic (not Paw-Patrol-specific) bugs:
1. Same driver crash as #870 (Astro Bot) and #519 (Stray) — this is now a 3rd independent title. 2 of 3 runs crashed with the identical stack:
0xC0000005
at Silk.NET.Vulkan.Vk.CreateComputePipelines(...)
at SharpEmu.Libs.VideoOut.VulkanVideoPresenter+Presenter.CreateComputePipeline(...)
at SharpEmu.Libs.VideoOut.VulkanVideoPresenter+Presenter.CreateComputeDispatchResources(...)
Dumped and validated the SPIR-V around the crash again (SHARPEMU_SHADER_SPIRV_DUMP_DIR + spirv-val) — same result as the other two titles: spec-valid SPIR-V, several of the compute shaders use the software wave64-over-two-wave32 emulation bridge (wave64MaskScratch/wave64BroadcastScratch) discussed on #870. Three unrelated titles now hitting the identical AV through the identical emulation code path on the same RDNA4 hardware is a pretty strong signal this is systemic, not per-title — cross-posting the tally to #870.
2. Same scePthreadMutexLock → DEADLOCK spin already flagged on #519 (Stray) — this is a 2nd independent title. The 1 run that didn't crash instead spun indefinitely (25M+ import calls, still going when I stopped it) on:
[LOADER][WARN] Import#25088340 result: ORBIS_GEN2_ERROR_DEADLOCK (9UK1vLZQft4) rdi=0x000000080761BB28 ...
Same mutex NID (scePthreadMutexLock), same shape as Stray's case — one guest mutex address repeatedly, permanently failing to lock. I already flagged a specific code-level lead for this on #519 (a self-owned/MutexTypeNormal re-lock check in PthreadMutexLockCore that returns success in one code path and DEADLOCK in a duplicate check a few lines later) — not re-pasting it here, but noting that it's not isolated to Stray, which makes it more likely worth prioritizing.
Net: real progress on the original issue, but this title is currently gated by the same two systemic bugs already being tracked on #870 and #519 rather than anything specific to Paw Patrol.
Same correction I just posted on #519, applies here too since Paw Patrol hits the identical scePthreadMutexLock → DEADLOCK pattern.
Traced the git history: the EDEADLK return for a NORMAL mutex self-relock is intentional, from #748, which deliberately reverted a more permissive "silent recursion" behavior after it was found to starve other threads on some other title. I found and fixed (#884) a narrower inconsistency — a duplicate fast-path check that #748 missed and still returned OK — but tested it against this exact Paw Patrol repro before opening that PR, and it does not change the observed behavior. This title was already hitting the already-strict SyncRoot-protected check.
So the open question is unchanged: something causes a genuine self-relock condition on this guest mutex, and the guest then retries forever instead of treating EDEADLK as fatal. Given #748 was evidence-based and title-validated, the EDEADLK return itself is likely correct emulation rather than a SharpEmu bug — the real mystery is why the self-relock condition is reached at all (guest-side bug SharpEmu is correctly surfacing, vs. a SharpEmu thread-identity issue). Not resolved yet; wanted to correct the earlier framing rather than leave it implying #884 would fix this.
Same refinement I just posted on #519 — applies here too since this is the identical mutex/loop shape.
Direct per-call tracing (not just the sampled import-result log) shows the spinning mutex is MutexTypeAdaptiveNp (type 4), not Normal — so #884 was never relevant to this hang. More importantly, traced one full run (62,378 calls): the same guest thread ID throughout, result=OK in 96% of calls, only 4% hitting the adaptive-mutex DEADLOCK path. This isn't a failing lock, it's a very hot, mostly-successful loop that never leads anywhere. A guest RBP-chain walk (temporary instrumentation, removed after) confirmed a real, stable guest caller chain, but I don't have symbol/disassembly tooling in reach to identify the actual function or what it's polling for.
Correcting my earlier framing: the pthread/kernel layer is behaving correctly here. The real blocker is upstream of it and still unidentified.
Could you check if with the last commit from the main branch you still have it ? a fix for 0xC0000005 erorr has been made.