Page 1 of 1

systemd-logind leaves thousands of session files

Posted: 2017/12/21 10:27:38
by Jimini
Hey there,

on a CentOS 7.4 system I am experiencing the problem, that /run/systemd/sessions contains over 210000 files, which leads to a full /run.

As I am not really familiar with systemd, debugging this problem is a bit complicated. A huge number of the session files belongs to a user (let's call him bob) and the service "crond". This user runs an instance of the monitoring tool "check_mk", which contains a number of cronjobs.

So, bobs oldest session files are from October. All sessions are in the state "closing", this means AFAIK, that the user has logged out, but left a background process.
We currently use systemd-219, in this version "KillUserProcesses" is by default set to "no". I did not change this setting so far, since I fear to break some of the monitoring stuff.

Is there a way to find out, which processes / commands / cronjobs led to the session files and why they where active, even after the user logged out?

Kind regards and thanks in advance,
Jimini

Re: systemd-logind leaves thousands of session files

Posted: 2017/12/21 13:41:30
by TrevorH
It's because you've updated systemd and not rebooted and it's lost its dbus connection. It's a known bug and is fixed in newer systemd versions but I am unsure if the fix will get backported to RHEL 7's systemd. You'll need to search bugzilla.redhat.com and see if there is an existing bz for it and if not, raise one.

Re: systemd-logind leaves thousands of session files

Posted: 2017/12/21 14:04:20
by Jimini
Oh my. I was browsing the web for about 2 days now, but without "dbus" as a part of the search string, I simply did not find this bug report:
https://bugs.centos.org/view.php?id=14278

Thank you for your hint, I will test, if a reboot solves the problem.

Greetings,
Jimini

Re: systemd-logind leaves thousands of session files

Posted: 2017/12/21 14:11:57
by TrevorH
For now, the safest solution is to treat systemd updates in the same way that you would e.g. glibc and schedule a reboot after the update.