Public bug reported:

On a system that is monitored via telegraf I found many abandoned
systemd session which I believe are created by a potential race where
systemd is reloading unit files and at the same time a user is
connecting to the system via ssh or is executing the su command.

The simple reproducer

for i in {1..100}; do ssh localhost sudo systemctl daemon-reload & ssh 
localhost sleep 1 & done
jobs -p | xargs --verbose --no-run-if-empty kill -KILL
systemctl status --all 2> /dev/null | grep --before-context 3 abandoned

will produce something similar to

           │ ├─  175 su - ubuntu
           │ ├─  178 -su
           │ ├─62375 systemctl status --all
           │ └─62376 grep --color=auto --before-context 3 abandoned
--
● session-273.scope - Session 273 of user ubuntu
   Loaded: loaded (/run/systemd/transient/session-273.scope; transient)
Transient: yes
   Active: active (abandoned) since Wed 2021-06-30 13:32:03 UTC; 4min 7s ago
--
● session-274.scope - Session 274 of user ubuntu
   Loaded: loaded (/run/systemd/transient/session-274.scope; transient)
Transient: yes
   Active: active (abandoned) since Wed 2021-06-30 13:32:03 UTC; 4min 7s ago
--
● session-30.scope - Session 30 of user ubuntu
   Loaded: loaded (/run/systemd/transient/session-30.scope; transient)
Transient: yes
   Active: active (abandoned) since Wed 2021-06-30 10:05:56 UTC; 3h 30min ago
--
● session-302.scope - Session 302 of user ubuntu
   Loaded: loaded (/run/systemd/transient/session-302.scope; transient)
Transient: yes
   Active: active (abandoned) since Wed 2021-06-30 13:32:04 UTC; 4min 6s ago
--
           │ ├─  175 su - ubuntu
           │ ├─  178 -su
           │ ├─62375 systemctl status --all
           │ └─62376 grep --color=auto --before-context 3 abandoned

The system in question is running Bionic, systemd-237-3ubuntu10.48

** Affects: systemd (Ubuntu)
     Importance: Undecided
     Assignee: Dan Streetman (ddstreet)
         Status: New

** Changed in: systemd (Ubuntu)
     Assignee: (unassigned) => Dan Streetman (ddstreet)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1934147

Title:
  systemd leaks abandoned session scopes

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1934147/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to