Leaking sessions in pam_systemd

Bug #2020177 reported by non7top
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

May 19 12:38:38 s20.wr0.ru sshd[3793128]: pam_systemd(sshd:session): Failed to create session: Maximum number of sessions (8192) reached, refusing further sessions.

# loginctl list-sessions|wc -l
8195

 # loginctl session-status 302548700
302548700 - topaz (450)
           Since: Tue 2022-10-18 09:29:02; 7 months 0 days ago
          Leader: 2637625
          Remote: 92.42.15.122
         Service: sshd; type tty; class user
           State: closing
            Unit: session-302548700.scope

# ps axf|wc -l
72

The only way I could figure to fix this is to reboot.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: systemd 245.4-4ubuntu3.21
Uname: Linux 4.15.0 x86_64
ApportVersion: 2.20.11-0ubuntu27.26
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDmesg:

Date: Fri May 19 12:58:47 2023
Lsusb: Error: [Errno 2] No such file or directory: 'lsusb'
Lsusb-t: Error: [Errno 2] No such file or directory: 'lsusb'
Lsusb-v: Error: [Errno 2] No such file or directory: 'lsusb'
ProcEnviron:
 SHELL=/bin/bash
 LANG=en_US.utf8
 TERM=xterm-256color
 PATH=(custom, no user)
ProcInterrupts: Error: [Errno 2] No such file or directory: '/proc/interrupts'
ProcKernelCmdLine: quiet
SourcePackage: systemd
UpgradeStatus: Upgraded to focal on 2022-01-26 (478 days ago)
acpidump:

mtime.conffile..etc.systemd.journald.conf: 2022-08-19T16:13:27.570934

Revision history for this message
non7top (non7top) wrote :
Revision history for this message
Nick Rosbrook (enr0n) wrote :

What makes you say the sessions are "leaked", exactly? Is there something odd about the sessions listed? I realize that is a large number, however.

Changed in systemd (Ubuntu):
status: New → Incomplete
Revision history for this message
non7top (non7top) wrote :

Well. I don't see any processes in the OS that would correspond to those sessions. The state of most of them is Closing. systemd also spams a lot about too many sessions. Looks like systemd doesn't close sessions properly.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

Can you please attach logs from a boot where this was seen? If the current boot exhibits this, you can use 0 as the boot id:

$ journalctl -u systemd-logind.service -b $boot_id > systemd-logind-logs.txt

Revision history for this message
non7top (non7top) wrote :

Not sure what the "boot" is, but here are the outputs from the same system:

# journalctl -u systemd-logind.service -b 0
-- Logs begin at Tue 2023-06-13 11:39:06 MSK, end at Tue 2023-06-13 12:44:33 MSK. --
-- No entries --

# loginctl session-status 302548700
302548700 - topaz (450)
           Since: Tue 2022-10-18 09:29:02 MSK; 7 months 25 days ago
          Leader: 2637625
          Remote: 92.42.15.122
         Service: sshd; type tty; class user
           State: closing
            Unit: session-302548700.scope
# loginctl list-sessions|wc -l
8195

Revision history for this message
non7top (non7top) wrote :
Revision history for this message
non7top (non7top) wrote :

My systemd reports

# systemd --version
systemd 245 (245.4-4ubuntu3.21)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

Revision history for this message
Nick Rosbrook (enr0n) wrote :

You don't have any logs for systemd-logind? Have you modified the log level at some point? I guess that bug does sound similar, but it is unclear and there is no real resolution on that bug.

Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.