Chromium – Exceed Data Ulimit

chromeulimit

I have set ulimit in /etc/security/limits.conf. When I log in into my desktop environment as user testuser normally (using slim login manager), everything works fine.

When I log in as user testuser via Xephyr (from my other session as another user), everything works fine except chromium browser. This is the error I get in dmesg:

Chrome_ChildIOT (2472): VmData 4310827008 exceed data ulimit 4294967296. Update limits or use boot option ignore_rlimit_data.

And chromium is unusable (it starts, but waits indefinitely to load any page)

All other programs except chromium have correct limits set. I have verified this using:

find /proc/ -maxdepth 1 -user testuser -exec cat {}/limits \; | grep 'Max data size'

all PIDs have Max data size set to unlimited:

Max data size             unlimited            unlimited            bytes

except chromium processes:

Max data size             4294967296           4294967296           bytes     
Max data size             17179869184          17179869184          bytes     
Max data size             17179869184          17179869184          bytes     
Max data size             17179869184          17179869184          bytes     
Max data size             17179869184          17179869184          bytes     
Max data size             17179869184          17179869184          bytes     
Max data size             17179869184          17179869184          bytes     
Max data size             17179869184          17179869184          bytes  

I would like to understand:

1) why does chromium have different limits than all other programs ?

2) where do the "default" limits come from (where does chromium take the limit 4294967296 from ?

3) how can I change these default limits once and for all, globally, for all processes regardless whether they use pam or not ?

Best Answer

  1. Why does chromium have different limits than all other programs?

Chromium may look like a simple application but it is not, first there is the multi-threading which makes chromium run multiple process for different tasks (extensions, tab, core web-engine, etc) then the virtualisation, chromium use many sandbox to isolate the browsing activities which make it use more ressources than other application, also the used web-engine is not a light one... add to that the different needed libraries that are required to run and other heavy ressources functions... some related documentations are available here, here and this article have some useful infos.

  1. Where do the "default" limits come from (where does chromium take the limit 4294967296 from?

4294967296 bytes (4096 MB, or 4GB limit) chromium have by design a 4GB limit this is hard coded, more infos about this is available here and here

  1. How can I change these default limits once and for all, globally, for all processes regardless whether they use pam or not?

Not an easy task but you are doing it right for most usual process, now for complicated process like chromium you need to customize your config for each "special" app.

For chromium there are some command parameters that can be used to customise/enable/disable features, you can try to use some of them to make chromium suit your needs, here are some interesting switch:

Those switch can be used with a command line like this /usr/bin/chromium --single-process

--single-process
--aggressive-tab-discard
--aggressive-cache-discard
--ui-compositor-memory-limit-when-visible-mb
--disk-cache-dir  # Use a specific disk cache location, rather than one derived from the UserDatadir.
--disk-cache-size  # Forces the maximum disk space to be used by the disk cache, in bytes.
--force-gpu-mem-available-mb  # Sets the total amount of memory that may be allocated for GPU resources
--gpu-program-cache-size-kb  # Sets the maximum size of the in-memory gpu program cache, in kb
--mem-pressure-system-reserved-kb  # Some platforms typically have very little 'free' memory, but plenty is available in buffers+cached. For such platforms, configure this amount as the portion of buffers+cached memory that should be treated as unavailable. If this switch is not used, a simple pressure heuristic based purely on free memory will be used.
--renderer-process-limit  # Overrides the default/calculated limit to the number of renderer processes. Very high values for this setting can lead to high memory/resource usage or instability.

You can also run chromium with a script that update the ulimit for it (note that values lower than 4GB may crash the browser...)

ulimit -Sv 4352000000 #4.2GB
/usr/bin/chromium

# or 0.42GB, it works but the browser may crash
#ulimit -Sv 435200000 #0.42GB
#/usr/bin/chromium
Related Question