Kaleido crashes when rendering a plot to an image using Plotly's `to_image()` method using Alpine Linux
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 32/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- docker, linux, python
- Bereich
- backend, infrastructure
Rechercherichtung
Beginne damit, den gemeldeten to_image()-Fehler in der Alpine-Docker-Umgebung mit Python 3.11, Kaleido 1.0.0rc0 und Chromium unter /usr/bin/chromium zu reproduzieren. Untersuche den Browserstart und den Fehler des GPU-Prozesses und überprüfe anschließend den erfolgreichen Abschluss, indem du ein Plotly-Bild renderst, ohne dass sich der Browser schließt oder BrowserClosedError auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 504
- Forks
- 65
- Ø Merge
- 6 T. 9 Std.
- Gemergte PRs (30 T.)
- 2
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus plotly/kaleido
-
Writing to an existing directory whose name has a dot fails with "Invalid format"Evtl. vergeben @RaphaelFakhri hat das vor 15 Tagen übernommen. Offenbug P3 size: 1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
-
Deterministic Rendering ChallengesEvtl. wieder frei @camdecoster hat das vor 69 Tagen übernommen, und es ist kein Pull Request offen. Offenenhancement feature P2 size: 5
-
[FEATURE]: Embed custom fonts into vector exports (no system install)Evtl. vergeben @camdecoster hat das vor 126 Tagen übernommen. Offenenhancement P3 size: 3
-
enhancement feature P3 size: 5
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
-
GlobalKaleidoServer is not thread-safeEvtl. vergeben @talleibman hat das vor 252 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
FinanceFlash/unvibecode#577 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area/test type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Clodmony/starship-coop#70 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
punitarani/fli#270 ·
-
🐛 Bug 🔔 Pending processing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
jumpserver/jumpserver#17980 ·
Maintainer antworten meist innerhalb von 1 Tag
-
community enhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
Maintainer antworten meist innerhalb von 1 Tag