Skip to content

Apple Silicon crash when Kaleido is launched with --disable-gpu (macOS 15.4.1, M4 Max) #323

@joaquinbejar

Description

@joaquinbejar

Image generation fails on Apple Silicon when Kaleido is started with --disable-gpu (macOS 15.4.1, M4 Max)

Summary

Running the standalone Kaleido v0.2.1 binary on macOS 15.4.1 (Sequoia) with an Apple M4 Max fails to produce any image whenever the --disable-gpu flag is present (the default set that Plotly‑rs passes).
Kaleido returns error 525 ("error creating static canvas/context for image server") instead of the expected base64 payload.
Removing only that flag makes rendering work again.

Environment

item version / value
Kaleido binary 0.2.1 (wheel installed via pip install kaleido)
macOS 15.4.1 (23E214)
Chip Apple M4 Max (arm64)
Python 3.12.3
Rust (for the original call) 1.86.0
Calling app plotly‑rs 0.12 (plot.write_image)

Reproduction steps

  1. Save this Plotly spec to spec.json:

    {"format":"png","width":800,"height":600,"scale":1.0,"data":{"config":{},"data":[{"name":"Surface","type":"surface","x":[1.0,2.0,3.0],"y":[4.0,5.0,6.0],"z":[[1.0,2.0,3.0],[4.0,5.0,6.0],[7.0,8.0,9.0]]}],"layout":{}}}
  2. Run Kaleido with the default flag set (notice --disable-gpu):

  cat spec.json | ./kaleido plotly \
--disable-gpu \
--allow-file-access-from-files \
--disable-breakpad \
--disable-dev-shm-usage \
--disable-software-rasterizer \
--single-process \
--no-sandbox \
> out.b64

Output:

[WARNING:resource_bundle.cc(431)] locale_file_path.empty() for locale en-US
{"code": 0, "message": "Success", "result": null, "version": "0.2.1"}
{"code":525,"message":"error creating static canvas/context for image server","pdfBgColor":null,"format":"png","result":null,"width":800,"height":600,"scale":1}

No image data is returned (result is null).

  1. Run again, this time without --disable-gpu:
cat spec.json | ./kaleido plotly \
--allow-file-access-from-files \
--disable-breakpad \
--disable-dev-shm-usage \
--disable-software-rasterizer \
--single-process \
--no-sandbox \
> out.b64

jq -r '.result' out.b64 | base64 -d > out.png   # PNG decodes correctly

Kaleido exits cleanly:

{"code": 0, "message": "Success", "result": null, "version": "0.2.1"}

Expected behaviour

Kaleido should render the plot (or at least fail gracefully) even when --disable-gpu is passed, matching behaviour on Intel Macs and Linux builds.

Actual behaviour

  • With --disable-gpu: Kaleido returns code 525 and no image.
  • Without --disable-gpu: Kaleido returns the expected base64 PNG.

Notes & hypothesis

  • Apple Silicon’s ANGLE‑Metal backend initialises fine; disabling the GPU appears to remove both hardware and software rasterisers, so Chrome cannot create the canvas.
  • The flag combo is hard‑coded in plotly‑rs (plotly_kaleido/src/lib.rs). Removing it there is an effective workaround.
  • The universal2 wheel of kaleido 1.0.0‑rc11 (Chromium 120) does not reproduce the issue, but Plotly‑rs has not migrated yet.

Workarounds

# simple wrapper to strip the flag
#!/usr/bin/env bash
exec /path/to/kaleido "${@/--disable-gpu/}"

or build/run Kaleido without passing the flag on macOS‑arm64.


Happy to provide additional logs or test patches.

— Joaquín

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleno activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions