** Description changed: 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 + $ for i in {1..100}; do sleep 0.2; ssh localhost sudo systemctl daemon- + reload & ssh localhost sleep 1 & done + + $ 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 + │ ├─ 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) + 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 + 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) + 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 + 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) + 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 + 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) + 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 + 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 + │ ├─ 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
** Description changed: 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 sleep 0.2; ssh localhost sudo systemctl daemon- reload & ssh localhost sleep 1 & done + + Wait > 1 second + + $ jobs -p | xargs --verbose --no-run-if-empty kill -KILL + + To clean out STOPPED jobs and $ 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 -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1934147 Title: systemd leaks abandoned session scopes Status in systemd package in Ubuntu: New Bug description: 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 sleep 0.2; ssh localhost sudo systemctl daemon-reload & ssh localhost sleep 1 & done Wait > 1 second $ jobs -p | xargs --verbose --no-run-if-empty kill -KILL To clean out STOPPED jobs and $ 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1934147/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp