[pulseaudio-discuss] Remaining PA process after X logout

Takashi Iwai tiwai at suse.de
Mon Feb 26 09:56:54 UTC 2018


On Mon, 26 Feb 2018 10:47:09 +0100,
Tanu Kaskinen wrote:
> 
> On Mon, 2018-02-26 at 10:20 +0100, Takashi Iwai wrote:
> > On Mon, 26 Feb 2018 10:12:44 +0100,
> > Tanu Kaskinen wrote:
> > > 
> > > On Sat, 2018-02-24 at 11:17 +0100, Takashi Iwai wrote:
> > > > Hi,
> > > > 
> > > > we've stumbled on a long-standing issue with PA, namely, PA fails to
> > > > start after relogin quickly.  The details and discussions are found in
> > > >   https://bugzilla.suse.com/show_bug.cgi?id=1052437
> > > > 
> > > > In short, the problem is that the session management removes
> > > > $XDG_RUNTIME_DIR (/run/users/*) after logout while PA remains running.
> > > > This leaves also the ESD socket in /tmp/esd-$uid, too.  When re-login,
> > > > a new PA process is kicked off because the old socket in /run/user/*
> > > > is gone.  Then it hits with the existing /tmp/esd-$uid, considering as
> > > > a fatal error, hence it aborts.
> > > > 
> > > > 
> > > > Now the primary question is what's the right approach to fix this.
> > > > I guess the best would be to kill PA properly at each X session logout
> > > > instead of self-killing after idle.  Then where's the best place to put
> > > > that?
> > > 
> > > Does suse use systemd to manage the pulseaudio user service?
> > 
> > It's started by XDG autostart.
> 
> So the good old autospawning mechanism. The XDG autostart script
> doesn't (any more) explicitly start pulseaudio, it just runs some pactl
> commands that as a side effect start the pulseaudio daemon if
> autospawning is enabled in client.conf.
> 
> > > If not,
> > > what component does remove $XDG_RUNTIME_DIR?
> > 
> > This is done by logind and pam_systemd, I suppose.
> 
> If KDE doesn't remove the runtime dir, then I'm out of theories about
> why this only happens with KDE...

KDE does remove the runtime dir, yes.  The session is managed by
systemd / logind.  But the start of the user services is a different
thing.

> > > It would seem logical that
> > > the same component would terminate services that break if their sockets
> > > are removed.
> > 
> > systemd *can* clean up the whole user-space (e.g. add
> > KillUserProcess=yes in /etc/logind.conf), but it's not enabled as
> > default.  There are users and services that want to keep running the
> > sfuff after logout (think of some computing task).  So forcibly
> > enabling this just for PA doesn't sound like a right solution,
> > either.
> 
> I agree.
> 
> > > What about fedora? I somehow would expect fedora to be eager to adopt
> > > the socket activation feature in pulseaudio that has been available for
> > > a long time already.
> > > 
> > > If you're using pulseaudio under systemd, it seems weird if all user
> > > services don't get terminated on logout.
> > 
> > I guess they would hit the same issue.  But maybe there can be some
> > workaround.
> 
> I don't think the same issue would affect pulseaudio if it was under
> systemd control, unless the user instance of systemd keeps running for
> longer than logind keeps the runtime dir around. I'd be very surprised
> if that was the case. I had a look at systemd documentation, which
> confirmed to me that when the user instance of systemd shuts down, it
> will stop all services that haven't explicitly requested not to be
> stopped.

The man page of logind.conf seems wrong.  The default value of
KillUserProcesses is "no" in the recent versions, judging from the
configure.ac; i.e. systemd doesn't behave aggressively to kill user
processes at logout.

Maybe this setup can be the difference between distros?


Takashi


More information about the pulseaudio-discuss mailing list