FS#61498 - [systemd] systemd-journald severe memory leak
Attached to Project:
Arch Linux
Opened by James Harvey (jamespharvey20) - Tuesday, 22 January 2019, 05:00 GMT
Last edited by Antonio Rojas (arojas) - Saturday, 21 September 2019, 09:06 GMT
Opened by James Harvey (jamespharvey20) - Tuesday, 22 January 2019, 05:00 GMT
Last edited by Antonio Rojas (arojas) - Saturday, 21 September 2019, 09:06 GMT
|
Details
Description: systemd-journald has a severe memory leak.
Severe enough that it crashed a VM with 1GB memory in about
5 days. Couldn't use open ssh, make new ssh, or console
login, and gave up after an hour and hard reset it. Severe
enough that the upstream reporter saw it getting up to about
30GB in 5 days.
Additional info: Upstream bugreport: https://github.com/systemd/systemd/issues/11502 Someone claims reverting 2d5d2e0 fixes the problem for them. If that's the case, this was committed on Dec 5, 2018. systemd 239.370-1 was put in the Arch repo on Dec 18, so it's possible if this is the offending commit that the bug goes that far back on Arch. But, I upgraded to 239.370-1 on 12/21, and the system stayed up fine until 1/16 when I finally updated it for the first time in a few weeks. After upgrading to 240.34-3 on 1/16, I rebooted, and the system crashed in about 5 days. So, I'm doubtful it goes back to 239.370-1, but I haven't checked the git tree to see if it's linear and would include it. Upstream comments suggest that every message logged stays in memory. journalctl log is attached, from when the problem started. That's the end of the log. I gave it an hour before rebooting, and there was nothing after this. Steps to reproduce: # ps axuk-vsz | grep journald | grep -v grep And watch it grow forever, until restarted. |
This task depends upon
$ while(true); do sudo pmap --extended $(pidof systemd-journald) | sort -rnk 2 | head -n 1; sleep 1; done
For me, second column (Kbytes, size of map) grows by about 2633K/sec (2.6MB/sec), and third column (RSS, resident set size) by about 9.7K/sec.
Running as root without sudo, and it shrinks by 90%+ percent, slowing to 219K/sec and 0.9K/sec.
Running as root without sudo, but running "base64 < /dev/urandom | logger" as non-root, and it stays growing at the smaller rate.
EDIT: JustArchi in upstream bugreport ran with "sleep 0.1", vs my "sleep 1". If I do that, each line grows at a similar rate, making the leak 10x worse.