Kaleido crashes when rendering a plot to an image using Plotly's `to_image()` method using Alpine Linux
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 32/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- docker, linux, python
- Lĩnh vực
- backend, infrastructure
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi to_image() đã được báo cáo trong môi trường Alpine Docker với Python 3.11, Kaleido 1.0.0rc0 và Chromium tại /usr/bin/chromium. Kiểm tra quá trình khởi chạy trình duyệt và lỗi của tiến trình GPU, sau đó xác minh việc hoàn tất bằng cách kết xuất một hình ảnh Plotly mà không để trình duyệt đóng hoặc phát sinh BrowserClosedError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 504
- Fork
- 65
- Merge trung bình
- 6 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của plotly/kaleido
-
Writing to an existing directory whose name has a dot fails with "Invalid format"Có thể đã có người làm @RaphaelFakhri đã nhận 12 ngày trước. Đang mởbug P3 size: 1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
-
Deterministic Rendering ChallengesCó thể làm lại được @camdecoster đã nhận 67 ngày trước và không có pull request nào đang mở. Đang mởenhancement feature P2 size: 5
-
[FEATURE]: Embed custom fonts into vector exports (no system install)Có thể đã có người làm @camdecoster đã nhận 124 ngày trước. Đang mởenhancement P3 size: 3
-
enhancement feature P3 size: 5
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
GlobalKaleidoServer is not thread-safeCó thể đã có người làm @talleibman đã nhận 249 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của plotly/kaleido
Issue tương tự
-
DBFS append mode silently overwrites existing filesCó thể đã có người làm @IlyaKhalafi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
fsspec/filesystem_spec#2429 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Retrieval rerank fallback statistics stay zero after provider failureCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
volcengine/OpenViking#7014 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fedora-copr/copr#4600 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ansys/pydpf-core#3620 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày