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

未关闭
#323 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
macos, python, rust

调研方向

从 plotly_kaleido/src/lib.rs 中的 flag 构造开始,使用提供的 spec.json 在 macOS arm64 上复现报告的 Kaleido 0.2.1 命令。比较启用和不启用 --disable-gpu 时的渲染结果;当默认 flag 集合在 Apple Silicon 上能够成功渲染或优雅地失败时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

stale

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

主要语言
Python
星标
504
派生
65
平均合并
6 天 9 小时
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

plotly/kaleido 的其他 Issue

查看 plotly/kaleido 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。