Sicos1977 / ChromiumHtmlToPdf

Convert HTML to PDF with a Chromium based browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Size issue

sejnik opened this issue · comments

Hi, next bug what i have in docker is, that when i use some SVG data .. chrome crash. Locally everything works well.
Is there some memory limit or somesthnig like that?
Docker has no limit.
Thanks a lot.

commented

No that I know of

commented

Try playing with using the old or new chrome headless and see if that makes a difference.

i tried set converter.UseOldHeadlessMode = true;

So the finnally.. it was resolve adding argument --disable-dev-shm-usage ;)

commented

I guess this stack overflow post is what you had --> https://stackoverflow.com/questions/69173469/meaning-of-selenium-chromeoptions

commented

--disable-dev-shm-usage
The /dev/shm partition is too small in certain VM environments, causing Chrome to fail or crash. Use this flag to work-around this issue (a temporary directory will always be used to create anonymous shared memory files).

See the bug details: https://bugs.chromium.org/p/chromium/issues/detail?id=715363

commented

Steps to reproduce the problem:

  1. Create a Docker container with the default /dev/shm size (64MB) or smaller (ideally, say, 10MB)
  2. Launch Chrome inside the container
  3. Browser may fail to load entirely. If not, attempt to browse to any mid-weight site, and either the tab or the browser will crash.

The above will occur even if there is a larger tmpfs partition (e.g. 512MB) available on the Docker container. Chrome insists on using the tiny /dev/shm partition to its own detriment, and it is not possible to modify this behavior.

What is the expected behavior?
Chrome should launch and load websites normally.

What went wrong?
The intent of this bug is to create a command-line flag or environment variable check that allows a user to specify a different path for Chrome to use instead of /dev/shm.

On most desktop Linux distributions, the default /dev/shm partition is large enough. However, on many cloud providers using Docker containers (such as the Google App Engine Flexible Environment) or Heroku, the default /dev/shm size is appreciably smaller (64MB and 5MB, respectively). On these platforms it's impossible to change the size of /dev/shm, which makes using Chrome difficult or impossible. This is particularly an issue for those who want to take advantage of its new headless mode.

If a command-line flag were added, e.g. --shared-memory-path=/tmp, it would become possible to use Chrome on these platforms.

commented

I will add this to the readme on the main page for other people that have this issue.

commented

Added