8000 Crash: GPU process signal 11 in _platform_strlen writing the Metal binary archive (macOS 27 / M5 Max) · Issue #129 · Wooloomooloo2/bloodborne_mac_port · GitHub
[go: up one dir, main page]

Skip to content

Crash: GPU process signal 11 in _platform_strlen writing the Metal binary archive (macOS 27 / M5 Max) #129

Closed

Description

@runty

Summary

The GPU process dies with signal 11 about 40 seconds into every launch, while PsoCache::WriterLoop writes the Metal pipeline binary archive. The fault is inside Metal, not in the port's own code: _platform_strlen is called with a null pointer from -[MTLBinaryArchive getArchiveIDWithErrorInternal:], reached from addComputePipelineFunctionsWithDescriptor:.

This is 100% reproducible on my machine (2/2 launches). Disabling the archive lets the game run normally past this point — it reached character creation with no crash.

Environment

Mac Mac17,7 — Apple M5 Max, 36 GB
macOS 27.2 (build 26B123)
GPU family AGXMetalG17X
Port mac-v0.5.12 prebuilt (BBCommit 50274ee); also reproduces when building master (a88dd8a)
Game Bloodborne CUSA03173, update 1.09 merged (game_check.py passes)
Launch 1920x1080, 120 FPS limit, default settings

The project's validated hardware appears to be M4 Max on macOS 26, so I suspect this is a Metal regression on macOS 27 / newer AGX family rather than something that would show up on the tested combinations.

Log

Crash: the GPU process crashed (signal 11 in _platform_strlen)
bbgpu-host: fatal fault (signal 11) at /usr/lib/system/libsystem_platform.dylib+0xb44 (_platform_strlen), address 0x0
0   bbgpu-host-macos27                  0x000000010457145c fault + 344
1   libsystem_platform.dylib            0x000003c01740a144 _sigtramp + 56
2   Metal                               0x000003c025f81940 -[MTLCompiler createBinaryArchiveAsRecompileTarget:compilerTask:completionHandler:] + 168
3   Metal                               0x000003c025ec58b8 __77-[_MTLBinaryArchive(MTLBinaryArchiveInternal) getArchiveIDWithErrorInternal:]_block_invoke + 204
4   libdispatch.dylib                   0x000003c0173da5a0 _dispatch_client_callout + 16
5   libdispatch.dylib                   0x000003c0173d0490 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6   Metal                               0x000003c025ec576c -[_MTLBinaryArchive(MTLBinaryArchiveInternal) getArchiveIDWithErrorInternal:] + 184
7   Metal                               0x000003c025f84eec -[MTLCompiler compileFunctionRequestInternal:frameworkLinking:linkDataSize:reflectionOnly:compilerTask:completionHandler:] + 7212
8   AGXMetalG17X                        0x000003c0e3d945c4 ... createComputeProgramVariant(MTLComputePipelineDescriptor*, ...AGXG17XFamilyBinaryArchive*, ...) + 3912
9   AGXMetalG17X                        0x000003c0e3d6899c -[AGXG17XFamilyBinaryArchive addComputePipelineFunctionsWithDescriptor:options:error:] + 536
10  libbbgpu.dylib                      0x000000010606383c _ZN5Metal8PsoCache12WriteArchiveEv + 500
11  libbbgpu.dylib                      0x00000001060635b4 _ZN5Metal8PsoCache10WriterLoopEv + 340
12  libbbgpu.dylib                      0x000000010606e51c std::__thread_proxy<...PsoCache::PsoCache(Device&, std::filesystem::path)::$_0...> + 52
GPU process: host lost (host process killed by signal 11) while rendering; exiting
Crash: the GPU process stopped unexpectedly (host process killed by signal 11)

What I ruled out

  • MTL_SHADER_VALIDATION=1 (which makes PsoCache skip the archive, mtl_pso_cache.mm:225) → no crash. The game loads, mounts SPRJ0005, plays the intro, reaches character creation. So the renderer itself is fine on this GPU.
  • BB_PIPELINE_CACHE=0 does not help — it only gates the SPIR-V shader DB (FreePermIndex), not PsoCache.

Suggested fix

The failing call is specifically addComputePipelineFunctionsWithDescriptor:, in this loop in PsoCache::WriteArchive():

const BOOL added =
    [descriptor isKindOfClass:[MTLRenderPipelineDescriptor class]]
        ? [fresh addRenderPipelineFunctionsWithDescriptor:descriptor error:&ns_error]
        : [fresh addComputePipelineFunctionsWithDescriptor:descriptor error:&ns_error];

Two options, in order of preference:

  1. Skip compute descriptors when adding to the archive (or guard them on the OS version), keeping render-pipeline caching — if the crash really is compute-only, this preserves almost all of the "2 compiles per session" win.
  2. An explicit opt-out, mirroring the existing MTL_SHADER_VALIDATION early return:
if (const char* env = std::getenv("BB_METAL_ARCHIVE"); env && env[0] == '0') {
    LOG_WARNING(Render, "Metal binary archive off (BB_METAL_ARCHIVE=0)");
    return;
}

I'm running a local build with option 2 and it's stable through character creation; the cost is the ~500 shader compiles per launch that the archive normally avoids.

Happy to test either approach, or a build that only skips compute, if that's useful.

Activity

  1. Wooloomooloo2 commented on Nov 5, 2026

    @Wooloomooloo2
    Owner

    Thanks @runty, that's an excellent report: the trace pointed straight at it.

    There's a fix on branch fix-129-archive (9bb8d56), close to your option 1. On an M5 (Apple10 GPU family) with macOS 27.2 or later, the archive now keeps compute pipelines out and still caches render pipelines. Every other Mac is unchanged, since M2s on 27.2 and M5s on 27.0.1 write the archive without trouble. It also adds your opt-out as BB_METAL_ARCHIVE=0 (no archive) and BB_METAL_ARCHIVE=render (render pipelines only, any Mac). The archive now gets a label as well, in case the missing ID comes from an unnamed archive 8000 .

    Here, a cold start with BB_METAL_ARCHIVE=render wrote 412 render pipelines, and the next start loaded them and compiled 61 compute pipelines. I can't reproduce the crash itself (no M5 here), so could you build that branch and check that it runs past the 40-second mark with no environment variable set? The log should say "Metal binary archive: render pipelines only".

  2. runty commented on Nov 6, 2026

    @runty
    Author

    Built 9bb8d56 and ran it with nothing set — env -u BB_METAL_ARCHIVE -u MTL_SHADER_VALIDATION,
    so neither variable could force a mode. Yes: it runs past the 40-second mark, and the log says
    exactly that line.

    Metal binary archive: render pipelines only (compute pipelines compile at each start; #129, BB_METAL_ARCHIVE)
    

    That was a cold start with no archive on disk. It went on to mount SPRJ0005 and open the name
    dialog, with the window live the whole time — zero crashes, and the writer ran ten times
    during the session without faulting, which is the path that killed 0.5.12 at ~40 s.

    Second start, same data folder, still nothing set:

    Metal binary archive: wrote 94 pipelines in 1724 ms; this session 92 from the archive, 34 compiled
    

    So the render pipelines come back from disk and only the compute ones compile.

    Mac17,7 (M5 Max, 36 GB), macOS 27.2 (26B123), Apple10 family, CUSA03173 v1.09.

  3. added 2 commits that reference this issue on Nov 6, 2026
  4. Wooloomooloo2 commented on Nov 7, 2026

    @Wooloomooloo2
    Owner

    @runty could you try 0.5.14? On M5 Macs with macOS 27.2 or later, it keeps compute pipelines out of the Metal binary archive. Writing them is where the crash was. The log should say "Metal binary archive: render pipelines only". If it still crashes, BB_METAL_ARCHIVE=0 turns the archive off completely, and the new crash report would help.

  5. runty commented on Nov 7, 2026

    @runty
    Author

    Confirmed on the M5 with 0.5.14:
    it runs past the 40-second mark with nothing set in the environment, and the log says exactly
    that line.

    • Cold start: Metal binary archive: render pipelines only, on to character creation, zero crashes.
    • Second start: 99 render pipelines restored from the archive, zero crashes.
    • Tested the released zip (d6bb3966…, bundle ee35a51) rather than a local build.

    So #129 looks fixed from my side.

  6. runty commented on Nov 7, 2026

    @runty
    Author

    One thing worth a line in the release notes, if it has not come up: I had BB_METAL_ARCHIVE=0
    sitting in launch.conf from the workaround, and that silently overrides the new default —
    the archive stays off and you get the old recompile-every-start behaviour with no crash to
    explain it. Anyone upgrading from a workaround build should delete that line. I hit it, and
    would not have noticed without the log line.

  7. Wooloomooloo2 commented on Nov 8, 2026

    @Wooloomooloo2
    Owner

    Thanks @runty for testing the release zip so carefully, and for the launch.conf catch. I've added a note to the 0.5.14 release notes: anyone who used the BB_METAL_ARCHIVE=0 workaround should delete that line, or the archive stays off. Closing as fixed in 0.5.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0