[systemd-devel] [PATCH v2 0/7] logind: close races on user and session states

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Feb 7 15:39:25 PST 2014

On Thu, Feb 06, 2014 at 09:37:13PM +0100, Djalal Harouni wrote:
> Summary:
> Currently logind will not clear sessions on logout. The bug is confirmed
> for getty and ssh logins. This series is preparation for next patches to
> address that bug, it does not fix it.
> However, this series also fixe real races on user and session states.
> This ensures that user_save() and session_save() functions will write the
> correct user and session state to the state files.
> The logind bug was already discussed here:
> http://lists.freedesktop.org/archives/systemd-devel/2014-January/015968.html

So, I did some testing with current git (ba978d7). And this bug
appears to be only partially gone. After my second user logs out, loginctl
stops showing the session. But the manager *remains*.

Hm, the manager remains, but /run/user/<uid>/systemd/ gets nuked.
So when the user logins in a second time, communication with user manager
is broken.

Attaching strace to systemd --user during the orignial session close yields...
nothing. Both systemd and (sd-pam) remain undisturbed...

In the logs I see (during user login and manager startup):

systemd-logind[2998]: Failed to process message [type=signal sender=:1.1 path=/org/freedesktop/systemd1/job/3284 interface=org.freedesktop.DBus.Properties member=PropertiesChanged signature=sa{sv}as]: Invalid argument

but nothing interesting during logout:

sshd[3075]: Received disconnect...
sshd[3043]: pam_unix(sshd:session): session closed for user user2
systemd-logind[2998]: Got message type=method_call sender=:1.70 destination=org.freedesktop.login1 object=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=ReleaseSession cookie=2 reply_cookie=0 error=n/a
systemd-logind[2998]: Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 object=/org/freedesktop/systemd1/unit/session_2d10_2escope interface=org.freedesktop.systemd1.Scope member=Abandon cookie=31 reply_cookie=0 error=n/a
systemd-logind[2998]: Got message type=signal sender=:1.1 destination=:1.68 object=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=UnitRemoved cookie=1585 reply_cookie=0 error=n/a
systemd-logind[2998]: Removed session 10.
systemd-logind[2998]: Sent message type=signal sender=n/a destination=n/a object=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=SessionRemoved cookie=34 reply_cookie=0 error=n/a
systemd-logind[2998]: User user2 logged out.
systemd-logind[2998]: Sent message type=signal sender=n/a destination=n/a object=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=UserRemoved cookie=36 reply_cookie=0 error=n/a


More information about the systemd-devel mailing list