[systemd-devel] logind and sessions tracking questions -

Djalal Harouni tixxdz at opendz.org
Thu Jan 23 07:04:16 PST 2014


On Wed, Jan 22, 2014 at 09:33:37AM +0000, Colin Guthrie wrote:
> 'Twas brillig, and Djalal Harouni at 20/01/14 12:18 did gyre and gimble:
> > Hi Coling,
> > 
> > Coling please I've some questions regarding what you have posted, see
> > below.
> > 
> > I'm trying to debug another bug in logind logic:
> > http://lists.freedesktop.org/archives/systemd-devel/2014-January/015968.html
> > 
> > I've located some bugs, I've a PoC version working, will post it but
> > first need to clear some points here to avoid breaking things.
> >> OK, this one is NOT active and is closing. This is likely an older
> >> session that has since been replaced after logging out and back in again
> >> but it keeps some binaries running (likely gpg-agent stuff at a first
> >> guess). Lets look:
> >
> > Here I assume you are using a new systemd version (Fedora 20)? or
> > systemd from git?
> 
> I'm on Mageia 4 RC, so systemd v208+patches (very similar set to Fedora 20)
Ok, nice!

> 
> > I noticed in old systemd v204, the "Active" flag would be set to
> > "yes"  when we logout and the session keeps some programs running like
> > 'screen'! I guess this also applies to gpg-agent...
> 
> The two bits here are actually orthoganal.
> 
> e.g. the session does not *need* to be active to leave programs like
> screen running. The session can be closing (meaning the session leader
> has gone), but still leave programs running. Such programs might timeout
> after a delay (e.g. pulseaudio does this). Others might actually stick
> around longer or indefinitely.
Thank you for confirming this. Yes I do realize that when the leader
has gone then the state can be closing. What I did notice is that in
previous systemd version 204 when the leader has gone, and on logouts then
in the session state file:
/run/systemd/sessions/X
ACTIVE=1		=> provided by session_is_active()
STATE=closing		=> provided by session_get_state()

So I was not sure if making "ACTIVE=1" was really intended for sessions
that leave processes running after logouts. Ok!

And thanks for the pulseaudio example, I did found an old thread of you
where you provide a session state check so clients like pulseaudio are able
to timeout ;-)

> >> Yup, in this case, I have my ssh-agent, gpg-agent and PulseAudio
> >> services all loaded under the previous session. They didn't timeout and
> >> stop after my logout and as things are not setup to kill all processes,
> > Please can you tell me about this last one "kill all processes" ?
> > 
> > How we set this flag? from my source code analysis I didn't found it and 
> > the new man page of pam_systemd does not show it:
> > http://www.freedesktop.org/software/systemd/man/pam_systemd.html
> 
> See man logind.conf and KillUserProcesses=
Ok.


> HTHs
> 
> Col
Thanks

-- 
Djalal Harouni
http://opendz.org


More information about the systemd-devel mailing list