On 03/02/2019 17.35, Peter Suetterlin wrote:
Carlos E. R. wrote:
I had no chance to kill firefox, system froze while I tried to issue the command.
The laptop has 4 gigs, the desktop has 8, so it takes longer to crash.
I might have to start firefox with ulimit, but I don't know what limits to give it.
This sounds similar to my hangs when my image processing started using more RAM than physically available, and it pushed anything from the GUI into swap. So any UI interaction would need swap-in, but that one had been busy due to the processing. In my case it was 'dead' for almost an hour - and then came back as if nothing happened....
My solution had been to limit the process using cgroups to not use more than MEM-2GB physical RAM. In other words, as soon as it wants more than that amount, it starts using swap. That leaves enough memory for the GUI to remain responsive.
Yes, but for that you have to know which process to limit. I don't have a clear culprit. I had been sleeping, the machine was idling. As I recall, I sat on my computer, had a glance at Thunderbird, there was an unsent usenet post, so clicked to send. Machine was responding normally, maybe a bit slow; I noticed on the "Multiload" applet that it was loaded on i/o, so I pressed the key combination to go one workspace to the left, where one terminal was running top, to have a look. Bamm! A terminal was white, failed to refresh. The log terminal displayed content of several hours earlier. The one with top did not respond to keys, as I wanted to kill firefox, which had 10.5 GB of virtual memory. Things finally froze completely.
For my machine here (16GB) the setup script looks like this:
lux:~ # cat bin/mk14Ggroup #!/bin/sh mkdir /sys/fs/cgroup/memory/14G echo 15032385536 > /sys/fs/cgroup/memory/14G/memory.limit_in_bytes chown root.users /sys/fs/cgroup/memory/14G/cgroup.procs chmod 775 /sys/fs/cgroup/memory/14G/cgroup.procs
Any user can then echo $PID > /sys/fs/cgroup/memory/14G/cgroup.procs and the process $PID will be limited that way.
I've even considered doing this on the main level, i.e., echo 15032385536 > /sys/fs/cgroup/memory/memory.limit_in_bytes
Then no process at all can use up all memory. I have not checked though if that works as intended. You might give it a try (of course with some smaller limit, something like 6.5-7GB for the 8GB machine)
-- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)