bitcrowd / chromic_pdf

Convenient HTML to PDF/A rendering library for Elixir based on Chrome & Ghostscript
Apache License 2.0
409 stars 37 forks source link

GPU renderer on a headless server? #236

Closed silverdr closed 1 year ago

silverdr commented 1 year ago

When starting Phx Application with ChromicPDF I get some errors out in the logs. The one that I think is closely related to way Chrome is started:

[0308/135155.636929:ERROR:gpu_init.cc(523)] Passthrough is not supported, GL is disabled, ANGLE is [...]

but there are other about dbus and co.

Then I see three Chrome (chromium) processes, with conflicting arguments like:

chromium --show-component-extension-options --enable-gpu-rasterization --no-default-browser-check [...] --disable-gpu [...]

and another one:

chromium --type=gpu-process --no-sandbox --disable-breakpad --enable-gpu-rasterization --headless --ozone-platform=headless --use-angle=swiftshader-webgl --headless --gpu-preferences=[]...]

Any quick fixes to those?

maltoe commented 1 year ago

Hi @silverdr

I'm having trouble to give you any "quick fixes" without a description of what doesn't work as expected.

Regardless, here are a few remarks/observations on your statements:

Hope this helps.

Best, malte

silverdr commented 1 year ago

Thank you for your response.

Since you're seeing the Chrome logs in your Phoenix logs/console, I assume you have set discard_stderr: false, right?

Correct.

It looked like the "master" process got those extra flag(s) from your invocation and since some GPU related features are enabled there (despite --disable-gpu), it spawns children like type=gpu-process and Co. dropping out errors. So my hope for quick fix was in double-checking the arguments/flags you pass when starting Chrome. Since you say those do not come from you I shall have to double-check whether the invoked command isn't in fact a wrapper script or something.

TNX