Kaleido crashes when rendering a plot to an image using Plotly's `to_image()` method using Alpine Linux
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 32/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- docker, linux, python
調査の方向性
まず、Python 3.11、Kaleido 1.0.0rc0、/usr/bin/chromium の Chromium を使用する Alpine Docker 環境で、報告された to_image() の失敗を再現します。ブラウザーの起動と GPU プロセスの失敗を調査し、その後、ブラウザーが終了したり BrowserClosedError が発生したりすることなく Plotly 画像をレンダリングして、完了を確認します。
索引モデルが issue の本文から書いたものです。
説明
Description:
I am using Kaleido to render Plotly plots as images via the to_image() method in an Alpine-based Docker environment. The process fails when Kaleido attempts to open Chromium, resulting in a GPU process crash. The error details and debug logs are provided below.
I’ve been trying to find a solution for this issue for a very long time now, and I’ve explored almost every possible approach, but Alpine Linux seems to be incompatible with Kaleido.
This issue has a substantial impact on our product and, I assume, on many other Plotly and Kaleido users facing similar constraints.
We would deeply appreciate it if you could prioritize this issue and allocate resources to apply a fix as soon as possible. The resolution of this problem is critical for our company, and we are willing to support the effort.
Steps to Reproduce:
- Build a Docker image using Alpine Linux.
- Install Kaleido and Plotly.
- Run
plotly.graph_objectswithto_image()to generate an image. - Observe the error related to GPU process failure.
Expected Behavior:
Kaleido should render the Plotly plot to an image without crashing.
Actual Behavior:
Kaleido fails to launch the GPU process and crashes, as shown in the error traceback.
Error Traceback:
Full traceback (with KALEIDO_DEBUG enabled) is attached at the end of the issue
[1229/134817.090956:ERROR:gpu_process_host.cc(976)] GPU process launch failed: error_code=1002
[1229/134817.090956:WARNING:gpu_process_host.cc(1416)] The GPU process has crashed 1 time(s)
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[1229/134817.705795:FATAL:gpu_data_manager_impl_private.cc(423)] GPU process isn't usable. Goodbye.
Additional Information:
- Chromium Path:
/usr/bin/chromium - Python Version: 3.11
- Plotly Version: 5.24.1
- Kaleido Version: 1.0.0rc0 (0.2.1 version does not works for Alpine Linux)
- Kaleido Debug Logs: The debug logs indicate that Kaleido is trying to launch the Chromium browser but fails due to GPU process issues:
**Displaying generated HTML***
<!DOCTYPE html>
<html>
<head>
<style id="head-style"></style>
<title>Kaleido-fier</title>
<script>
window.KaleidoReport = ["start"];
function logError(e) {
window.KaleidoReport.push("error");
window.KaleidoReport.push(e);
if (!navigator.onLine) {
window.KaleidoReport.push("offline");
}
}
</script>
<script>
window.PlotlyConfig = {MathJaxConfig: 'local'}
</script>
<script src="https://cdn.plot.ly/plotly-2.35.2.min.js" charset="utf-8" onerror="logError('plotly')"></script>
<script type="text/javascript" id="MathJax-script" src="file:///usr/local/lib/python3.11/site-packages/kaleido/vendor/mathjax/MathJax.js?config=TeX-AMS-MML_SVG" onerror="logError('mathjax')"></script>
<script src="file:///usr/local/lib/python3.11/site-packages/kaleido/vendor/kaleido_scopes.js" onerror="logError('scoper')"></script> </head>
<body style="{margin: 0; padding: 0;}"><img id="kaleido-image"><img></body>
</html>
***end****
**Displaying generated HTML***
<!DOCTYPE html>
<html>
<head>
<style id="head-style"></style>
<title>Kaleido-fier</title>
<script>
window.KaleidoReport = ["start"];
function logError(e) {
window.KaleidoReport.push("error");
window.KaleidoReport.push(e);
if (!navigator.onLine) {
window.KaleidoReport.push("offline");
}
}
</script>
<script>
window.PlotlyConfig = {MathJaxConfig: 'local'}
</script>
<script src="file:///usr/local/lib/python3.11/site-packages/plotly/package_data/plotly.min.js" charset="utf-8" onerror="logError('plotly')"></script>
<script type="text/javascript" id="MathJax-script" src="file:///usr/local/lib/python3.11/site-packages/kaleido/vendor/mathjax/MathJax.js?config=TeX-AMS-MML_SVG" onerror="logError('mathjax')"></script>
<script src="file:///usr/local/lib/python3.11/site-packages/kaleido/vendor/kaleido_scopes.js" onerror="logError('scoper')"></script> </head>
<body style="{margin: 0; padding: 0;}"><img id="kaleido-image"><img></body>
</html>
***end****
No loop, no thread
STDERR: <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
TEMP DIR NAME: /tmp/tmpm8s2vf_a
DEBUG REPORT:
BROWSER_PATH: /usr/bin/chromium
USER_DATA_DIR: /tmp/tmpm8s2vf_a
read_jsons (blocking):
write_json:Starting watchdog
write_json: {"id": 0, "method": "Target.getTargets"}
wrote_json.
Old Headless mode will be removed from the Chrome binary soon. Please use the new Headless mode (https://developer.chrome.com/docs/chromium/new-headless) or the chrome-headless-shell which is a standalone implementation of the old Headless mode (https://developer.chrome.com/blog/chrome-headless-shell).
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[1229/134816.424079:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[1229/134816.472629:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[1229/134816.475996:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[1229/134817.080670:WARNING:bluez_dbus_manager.cc(234)] Floss manager service not available, cannot set Floss enable/disable.
[1229/134817.090198:ERROR:gpu_process_host.cc(976)] GPU process launch failed: error_code=1002
[1229/134817.090956:WARNING:gpu_process_host.cc(1416)] The GPU process has crashed 1 time(s)
{"id":0,"result":{"targetInfos":[]}}
[1229/134817.200035:ERROR:gpu_process_host.cc(976)] GPU process launch failed: error_code=1002
[1229/134817.200133:WARNING:gpu_process_host.cc(1416)] The GPU process has crashed 2 time(s)
read_jsons: {'id': 0, 'result': {'targetInfos': []}}
run_read_loop() found future for key ('', 0)
read_jsons (blocking):
Creating tab w/ file: file:///root/.kaleido-s36n1r02/index.html
write_json:
[1229/134817.228431:ERROR:gpu_process_host.cc(976)] GPU process launch failed: error_code=1002
[1229/134817.228537:WARNING:gpu_process_host.cc(1416)] The GPU process has crashed 3 time(s)
write_json: {"id": 1, "method": "Target.createTarget", "params": {"url": "file:///root/.kaleido-s36n1r02/index.html"}}
wrote_json.
{"id":1,"result":{"targetId":"8A944A2E7E2C38FFA32651B3B76FC251"}}
[1229/134817.572600:ERROR:gpu_process_host.cc(976)] GPU process launch failed: error_code=1002
[1229/134817.574345:WARNING:gpu_process_host.cc(1416)] The GPU process has crashed 4 time(s)
read_jsons: {'id': 1, 'result': {'targetId': '8A944A2E7E2C38FFA32651B3B76FC251'}}
run_read_loop() found future for key ('', 1)
write_json:
write_json: {"id": 2, "method": "Target.attachToTarget", "params": {"targetId": "8A944A2E7E2C38FFA32651B3B76FC251", "flatten": true}}
wrote_json.
read_jsons (blocking):
[1229/134817.649732:ERROR:gpu_process_host.cc(976)] GPU process launch failed: error_code=1002
[1229/134817.649846:WARNING:gpu_process_host.cc(1416)] The GPU process has crashed 5 time(s)
{"method":"Target.attachedToTarget","params":{"sessionId":"82ABBD20EBBEDF8A0A4CF0BF552E0648","targetInfo":{"targetId":"8A944A2E7E2C38FFA32651B3B76FC251","type":"page","title":"","url":"file:///root/.kaleido-s36n1r02/index.html","attached":true,"canAccessOpener":false,"browserContextId":"DA133DEF98442C73694452C71FBB83AB"},"waitingForDebugger":false}}
read_jsons: {'method': 'Target.attachedToTarget', 'params': {'sessionId': '82ABBD20EBBEDF8A0A4CF0BF552E0648', 'targetInfo': {'targetId': '8A944A2E7E2C38FFA32651B3B76FC251', 'type': 'page', 'title': '', 'url': 'file:///root/.kaleido-s36n1r02/index.html', 'attached': True, 'canAccessOpener': False, 'browserContextId': 'DA133DEF98442C73694452C71FBB83AB'}, 'waitingForDebugger': False}}
Checking subscription key: * against event method Target.attachedToTarget
All subscription: {'method': 'Target.attachedToTarget', 'params': {'sessionId': '82ABBD20EBBEDF8A0A4CF0BF552E0648', 'targetInfo': {'targetId': '8A944A2E7E2C38FFA32651B3B76FC251', 'type': 'page', 'title': '', 'url': 'file:///root/.kaleido-s36n1r02/index.html', 'attached': True, 'canAccessOpener': False, 'browserContextId': 'DA133DEF98442C73694452C71FBB83AB'}, 'waitingForDebugger': False}}
read_jsons (blocking):
{"id":2,"result":{"sessionId":"82ABBD20EBBEDF8A0A4CF0BF552E0648"}}
read_jsons: {'id': 2, 'result': {'sessionId': '82ABBD20EBBEDF8A0A4CF0BF552E0648'}}
run_read_loop() found future for key ('', 2)
Activating page
write_json:
write_json: {"id": 0, "method": "Page.bringToFront", "sessionId": "82ABBD20EBBEDF8A0A4CF0BF552E0648"}
wrote_json.
read_jsons (blocking):
[1229/134817.705593:ERROR:gpu_process_host.cc(976)] GPU process launch failed: error_code=1002
[1229/134817.705708:WARNING:gpu_process_host.cc(1416)] The GPU process has crashed 6 time(s)
[1229/134817.705795:FATAL:gpu_data_manager_impl_private.cc(423)] GPU process isn't usable. Goodbye.
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
Browser is being closed because chrom* closed
is_closed called with wait: 0
Browser was already closed.
caught OSError in read() [Errno 9] Bad file descriptor
Tempfile still exists?: False
Exception in callback Browser.run_read_loop.<locals>.check_error(<Task cancell...owser.py:671>>) at /usr/local/lib/python3.11/site-packages/choreographer/browser.py:663
handle: <Handle Browser.run_read_loop.<locals>.check_error(<Task cancell...owser.py:671>>) at /usr/local/lib/python3.11/site-packages/choreographer/browser.py:663>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/kaleido/**init**.py", line 65, in to_image
res = await tab.send_command("Page.bringToFront")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
choreographer.browser.BrowserClosedError: Command not completed because browser closed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.11/site-packages/choreographer/browser.py", line 664, in check_error
e = result.exception()
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/choreographer/browser.py", line 673, in read_loop
responses = await self.loop.run_in_executor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError
Error while generating bar chart. Command not completed because browser closed.
- 主要言語
- Python
- スター
- 504
- フォーク
- 65
- 平均マージ
- 6日 9時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
plotly/kaleido のほかの issue
-
Writing to an existing directory whose name has a dot fails with "Invalid format"対応中かも @RaphaelFakhri が 13 日前に担当しました。 オープンbug P3 size: 1
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
-
Deterministic Rendering Challenges再び着手できるかも @camdecoster が 68 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement feature P2 size: 5
-
[FEATURE]: Embed custom fonts into vector exports (no system install)対応中かも @camdecoster が 124 日前に担当しました。 オープンenhancement P3 size: 3
-
enhancement feature P3 size: 5
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
GlobalKaleidoServer is not thread-safe対応中かも @talleibman が 250 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
似ている issue
-
Server mode OAuth2: 'NoneType' object is not subscriptable on every request after re-submitting the OAuth2 login while already logged in対応中かも @Rarasinhoo が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
pgadmin-org/pgadmin4#10733 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws-samples/sample-per-model-bedrock#752 ·
メンテナーはふだん 1 日以内に返信
-
lesson-submission pending-review
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
Ikalus1988/MisakaNet#4452 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OCHA-DAP/topo-tools#250 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信