[systemd-devel] gdm's PulseAudio not exiting.
Colin Guthrie
gmane at colin.guthr.ie
Mon Sep 3 06:47:37 PDT 2012
Hi,
Been poking about trying to work out why gdm's session would not exit.
[colin at jimmy systemd-189]$ loginctl session-status 1
1 - gdm (492)
Since: Mon, 03 Sep 2012 09:30:34 +0100; 4h 42min ago
Leader: 3203
Seat: seat0; vc1
Display: :0
Service: gdm-launch-environment; type x11; class user
State: closing
CGroup: name=systemd:/user/gdm/1
├ 3498 /usr/bin/pulseaudio --start --log-target=syslog
└ 3707 /usr/lib64/pulse/gconf-helper
So PA is running.
Debugging a little further:
[gdm at jimmy ~]$ pacmd list-clients
Welcome to PulseAudio! Use "help" for usage information.
>>> 2 client(s) logged in.
index: 0
driver: <module-systemd-login.c>
owner module: 17
properties:
application.name = "Login Session 1"
systemd-login.session = "1"
index: 21
driver: <cli.c>
owner module: 24
properties:
application.name = "UNIX socket client"
So there is a client still around for module-systemd-login which
prevents PA from doing it's idle exit.
Looking at the PA code for this module, it seems that it just lists all
the sessions via:
r = sd_uid_get_sessions(getuid(), 0, &sessions);
This means that it will return if there are any sessions, active or
otherwise.
I agree that if any session exits then the PA module should indeed keep
a client active and prevent idle exit. The actual state of the session
shouldn't really matter - if it exists, it's good enough (which allows
for fast user switch etc.)
However there is one caveat to that... if the session is in
"State=closing", then it should be ignored by PA, as otherwise there is
a deadlock.
Sadly there is no call in sd-login.c that can filter sessions in this
way. And even looking in the env file itself:
[colin at jimmy systemd-189]$ cat /run/systemd/users/492
# This is private data. Do not parse.
NAME=gdm
STATE=online
CGROUP=/user/gdm
RUNTIME=/run/user/492
DISPLAY=1
SESSIONS=1
SEATS=seat0
ACTIVE_SESSIONS=
ACTIVE_SEATS=
It does not seem to reflect anything to do with the fact that the
session is closing.
So, how can I differentiate between an State=active session and a
State=closing one via the sd_* methods?
Does something extra need to get added to this env var and a new API
method added to sd-login.c to cope with this?
I would propose that STATE= variable gets updated to "closing" here (if
possible) and that sd_uid_get_sessions() is modified such that passing a
require_active value of 2 (or -1?) would only return if a session is
both SESSIONS=(>=1) and STATE=(active|online).
Alternatively, we could just make uid_get_array() always require that
STATE=(active|online) and make that hard coded.
WDYT?
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited http://www.tribalogic.net/
Open Source:
Mageia Contributor http://www.mageia.org/
PulseAudio Hacker http://www.pulseaudio.org/
Trac Hacker http://trac.edgewall.org/
More information about the systemd-devel
mailing list