Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#47668 - [linux] 4.3.3-2: Regression, Memory leak while browsing

Attached to Project: Arch Linux
Opened by Florian Beverborg (Crazyachmed) - Friday, 08 January 2016, 09:55 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 02 October 2017, 23:04 GMT
Task Type Bug Report
Category Kernel
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description: After upgrade there is a memory leak when using Chromium or Firefox (and possilby other things). Reverting the kernel to 4.2.5-1 fixes the issue.


Additional info:
* GPU is NVIDIA Corporation G86 [Quadro NVS 290]
* xorg-server 1.18.0-3
* Happens with nvidia-340xx (within minutes to an hour) or nouveau (within some hours)
* At some point the OoM-Killer reaps the browser, but that actually does not free that much memory (the browsers are obviously the "largest" processes in my session)
* At some point the memory is exhausted enough that xorg hangs and I have to power cycle.


How can I see where the memory is allocated in kernel? There is no process actually allocating excessive RAM (according to htop and ps)


Steps to reproduce:
* Open Chromium, Chrome or Firefox to random sites and wait (even with locked screen and no interaction)
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Monday, 02 October 2017, 23:04 GMT
Reason for closing:  Fixed
Additional comments about closing:  fixed for OP with linux 4.4.1-2
Comment by jb (jb.1234abcd) - Sunday, 10 January 2016, 09:11 GMT
http://elinux.org/Runtime_Memory_Measurement

To look for a clue take meminfo, ps, etc snapshots at time intervals while browsing:
$ cat /proc/meminfo
$ firefox &
$ cat /proc/meminfo
etc

Use valgrind:
$ valgrind firefox
but it would be better to recompile firefox with debug option -g and then use valgrind.

Comment by Hussam Al-Tayeb (hussam) - Sunday, 10 January 2016, 15:22 GMT
Do it recover any memory if you do the following?
systemctl isolate multi-user.target
rmmod nvidia_modeset nvidia drm

then type:
free
You will need to modprobe nvidia nvidia-modeset before restarting Xorg.
Comment by Florian Beverborg (Crazyachmed) - Monday, 11 January 2016, 11:01 GMT
Regarding vlagrind: I don't now what exaclty valgrind does, but it's not the browser processes leaking the memory, otherwise killing them should resolve the issue, right?

Anyhow, I switched back to kernel 4.3 and took the output of "date;free;cat /proc/meminfo" three times. Used (not cached!) RAM usage was about 80% in the file meminfo3. For meminfo4 I switched to multi-user.target with no real effect (of course some RAM is freed because there are much less processes). The file meminfo5 was taken after "echo 0 > /sys/class/vtconsole/vtcon1/bind; rmmod nouveau", also with no noticable change. Also there is the output from "ps aux" from that point.

Anything else I can unload or take a look at?
Comment by jb (jb.1234abcd) - Monday, 11 January 2016, 12:49 GMT
I noticed that outputs from 'cat /proc/meminfo' do not show the very bottom line:
...
DirectMap4k: 111180 kB
DirectMap2M: 5908480 kB
DirectMap1G: 3145728 kB <---------------

Next, you may want to compare IPC data (from good and bad kernel runs, with the same user space environment):
$ lsipc
$ ipcs

Next, have you tried to eliminate graphics driver as a cause ?
Add /etc/X11/xorg.conf.d/xorg.conf and restart Xorg server.
Section "Device"
Identifier "Configured Video Device"
Driver "vesa"
EndSection

Verify:
$ free
$ cat /proc/meminfo
$ lsipc
$ ipcs
etc
Comment by Mort Yao (soimort) - Saturday, 16 January 2016, 19:42 GMT
I'm experiencing a similar issue with Intel i915; random lockups in a few hours that I need a hard reset, even when the desktop is left untouched and Chromium processes are the only large processes running at that point.

* linux 4.3.3-2
* xf86-video-intel 1:2.99.917+519+g8229390-1
* xorg-server 1.18.0-4

The freezing issue never happened prior to linux-4.2.1, though it gets extremely more often since the latest kernel upgrade (linux 4.3.3-2). It already happened to me like 3 times. Not sure if it's related to memory leak, though.
Comment by Florian Beverborg (Crazyachmed) - Monday, 18 January 2016, 14:51 GMT
Here is the output from the IPC commands. Please note that I have no line "DirectMap1G:" and I did not cut anything off. Next I will try running with the vesa driver.

mem-4.2 is from kernel 4.2 after boot
mem-4.3 same for 4.3
mem-4.3_5 is after 3.5h of uptime (leak here)
Comment by Florian Beverborg (Crazyachmed) - Monday, 18 January 2016, 15:05 GMT
I've switched to vesa, but the leak is the same. With "gnome-system-monitor" you can see nicely that memory usage increaes by 0.3MiB per second :(
   vesa (4.5 KiB)
Comment by jb (jb.1234abcd) - Monday, 18 January 2016, 17:14 GMT
These are your memory eaters:
$ ps -e -orss=,args= | sort -b -k1,1n
Comment by Florian Beverborg (Crazyachmed) - Tuesday, 19 January 2016, 14:33 GMT
Since there isn't any process eating memory running ps doesn't make much sense, but I have attached the output nonetheless. This was after I stopped lightdm, so with very little processes at all still running, also I gathered the usual output like the last times.

So far I can confirm the following:

- Issue independent of graphics driver (nvidia, nouveau or vesa)
- No issue when starting with "init=/bin/sh"
- No issue when starting with option "single"
- Issue present when starting lightdm without logging in
- I still don't now where the memory "goes"
Comment by Hussam Al-Tayeb (hussam) - Tuesday, 19 January 2016, 15:11 GMT
I have a similar issue.
If I reboot the computer and immediately do 'systemctl isolate rescue.target', I see around 70MB memory usage.
If I go back to graphical target for 12 hours and back to rescue.target, clear /tmp, memory usage is around 90MB.
It increases by 20 MB per 24 hours after that.

Going to rescue.target and running systemctl daemon-rexec and systemctl restart systemd-timesyncd, systemd-udevd, systemd-journald free ~2MB so the main leak is in the kernel.

plugging in my phone to a usb port on the computer seems to add to those memory leaks.
rmmod nvidia_modeset nvidia drm and modprobing them again isn't freeing any memory.
I am pretty sure kernel 4.2.x didn't have those issues.
only 4.3 and 4.4 seem to be affected.
Comment by Florian Beverborg (Crazyachmed) - Monday, 01 February 2016, 11:39 GMT
Issue still present with 4.3.3-3
Comment by jb (jb.1234abcd) - Monday, 01 February 2016, 15:32 GMT
@ Florian
> - Issue present when starting lightdm without logging in

This DM and its lightdm-[gtk|kde]-greeter have a history of causing memory leaks:
https://forums.gentoo.org/viewtopic-p-7865050.html?sid=808a147dd090b6d701f24d52ea9fb98a

I would suggest you test with:
1. a different display manager/greater
2. without display manager/greater, i.e. reconfigure your systemd to start with text tty, login, and startx.

Ref: Google search: lightdm memory leak
Comment by Florian Beverborg (Crazyachmed) - Tuesday, 02 February 2016, 13:18 GMT
I switched to LXDM and there is no difference, memory still leaks. Also all LightDM-leaks are fixed by restarting the x-server - I have a problem in the kernel somewhere.
Comment by Keith Curtis (KeithCu) - Wednesday, 03 February 2016, 23:33 GMT
Over the last month, my computer has run out of memory and crashed 20 times with my Intel graphics hardware when doing video-intensive stuff. I went back to 4.2.5 and it was a lot better but seemed to still have some slow leaks. I'm now running 4.4.1 and it seems to be all fine again.
Comment by Keith Curtis (KeithCu) - Thursday, 04 February 2016, 03:04 GMT
Actually, I take it back. After playing with 4.4.1 for a number more hours, I got it to run out of RAM again. It's definitely a kernel leak: my computer runs out of memory, but it isn't reported from any process.
Comment by Florian Beverborg (Crazyachmed) - Thursday, 04 February 2016, 11:48 GMT
Found the issue: My unused WiFi-USB-Stick. Issue starts when it is plugged in. The issue is most likley only present when NetworkManager is polling for available networks, that is why it does not appear without the X-Session.

Bus 002 Device 005: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

(pulling it and unloading its modules does not free RAM)

Let me try that tomorrow with kernel 4.4
Comment by Hussam Al-Tayeb (hussam) - Thursday, 04 February 2016, 11:56 GMT
Then it is the same thing I described in my above comment. The issue is in the USB driver. Every time you plug something in, more memory is used and not released on unplugging.
I don't have networkmanager.
Comment by Florian Beverborg (Crazyachmed) - Monday, 08 February 2016, 12:43 GMT
Issue is fixed with kernel 4.4.1-2 for me (with the Wifi-Stick plugged in)

Loading...