systemd-logind leaves thousands of session files

Issues related to applications and software problems
Post Reply
Jimini
Posts: 5
Joined: 2017/12/08 09:52:08

systemd-logind leaves thousands of session files

Post by Jimini » 2017/12/21 10:27:38

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

User avatar
TrevorH
Forum Moderator
Posts: 23644
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: systemd-logind leaves thousands of session files

Post by TrevorH » 2017/12/21 13:41:30

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.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

Jimini
Posts: 5
Joined: 2017/12/08 09:52:08

Re: systemd-logind leaves thousands of session files

Post by Jimini » 2017/12/21 14:04:20

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

User avatar
TrevorH
Forum Moderator
Posts: 23644
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: systemd-logind leaves thousands of session files

Post by TrevorH » 2017/12/21 14:11:57

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.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply