[Webkit-unassigned] [Bug 164052] [GTK] Since the memory pressure relief has been activated, my disk has a high usage and the desktop stalls

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 24 04:10:04 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=164052

--- Comment #17 from Carlos Alberto Lopez Perez <clopez at igalia.com> ---
(In reply to comment #16)
> (In reply to comment #14)
> > (In reply to comment #8)
> > > (In reply to comment #6)
> > > > The 'Resources' tab in gnome-system-monitor showed memory use jump to 7G+
> > > > and there was a similar rise in CPU activity. Possibly due to kswapd. Next
> > > > time (the machine freezes so I can interact while this is going on) I will
> > > > keep the 'Processes' tab open and see what happens there.
> > > > 
> > > 
> > > Please, try the following:
> > > 
> > > 1. Download this script https://people.igalia.com/clopez/printwebkitmemory.sh
> > > 2. Execute it and redirect the output to a file:
> > 
> > Damn! I can't get it to swap on this Fedora 24 laptop with
> > webkitgtk4-2.14.1-1.fc24.x86_64. It used to happen very predictably with the
> > same version, and both my laptops used to be very similar memory-wise - 8G
> > RAM, no swap partition.
> > 
> > Maybe I just need to go back to using Ephy by default to trigger it again.
> > (I have temporarily switched to Firefox.)
> 
> I managed to trigger this a few times by - (a) opening a bunch of links from
> FB, (b) creating Fedora updates from admin.fedoraproject.org/updates.
> Unfortunately when kswapd kicks in, the printwebkitmemory.sh script crashes.
> 'fork' fails with 'unable to allocate memory', which crashes the bash child
> process.
> 
> Maybe I should actually test some of the webkit patches that were posted. Is
> there any scratch build for Fedora 24 or 25 that I could try?

Wow...

Ok... you can use cgroups to run the browser inside a memory cgroup with a limited amount of RAM. 

Do this:

# Create the memory cgroup
$ sudo cgcreate -a $USER:$USER -s 777 -g memory:/webkit
# Set it to have a limit of 3GB soft / 4GB hard. (If you only have 4GB of RAM or less lower this values)
$ echo $(( 3 * 1024 * 1024 * 1024 )) > /sys/fs/cgroup/memory/webkit/memory.limit_in_bytes
$ echo $(( 4 * 1024 * 1024 * 1024 )) > /sys/fs/cgroup/memory/webkit/memory.memsw.limit_in_bytes
# Run the browser inside the cgroup
$ cgexec -g memory:webkit /path/to/MinibBrowser


Now you can also check the cgroup memory stats when the browser runs:

$ while sleep 1; do cat /sys/fs/cgroup/memory/webkit/memory.memsw.usage_in_bytes; done

The browser will not be allowed to use more than 4GB of RAM, so the rest of your system will work without problem even if it goes crazy. The kernel will just kill it if it attempts to use more than 4GB.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161124/90d93753/attachment.html>


More information about the webkit-unassigned mailing list