:: Re: [DNG] Killing background proces…
Top Page
Delete this message
Reply to this message
Author: Dan Purgert
Date:  
To: dng
Subject: Re: [DNG] Killing background processes on logout [was Re: resolved]
KatolaZ wrote:
> On Wed, Jun 08, 2016 at 12:13:48PM +0200, Didier Kryn wrote:
>
> [cut]
>
> >
> >     Yes, nohup. I guess it issues setsid() and disconnects from the
> > controlling terminal, but any process can do that on its own. I was thinking
> > of a way to decide which session can do that and which cannot, and I imagine
> > it is only possible by running the session in a container (I don't know in
> > detail how containers work), which is AFAIU what systemd does, but might be
> > done by KISS means.

> >
> [snip]
>
> The main problem with the "solution" proposed by systemd is that it
> breaks things that already work (e.g., screen, nohup, mosh, and
> thousands of user programs, for which this "behaviour" is totally
> unexpected and meningless...) by enforcing an entirely new *policy*,
> motivated by the availability of a convoluted *mechanism*, which in
> turn was invented to solve the problems of poor programming of
> GNOME-related programs that remain hanging out there for who knows
> what reason.


This was in the comments of the article on lwn (sorry, I forget who
linked it on the mailing list). I'm honestly not sure how "true" it is,
but it seems to coincide with what else I've been reading.

1. In the beginning there was there login. Every process started after
login was a child of it, the kernel used a very simple process to track
those children and so it was easy to clean up on logout.

2. Then X and xdm replaced login, but every process was a child of xdm,
and cleaning up on logout remained simple.

3. Then there was GNOME, and gdm, and later gdm spawned corba. Things
were rapidly getting more complex, but nonetheless everything was a
process child of gdm and so cleaning up on logout was till simple.

4. GNOME moves to dbus.

5. systemd takes over dbus.

6. systemd takes over session management - primarily via logind.

7. GNOME immediately adopts logind, causing much angst on Debian because
it meant the default desktop required you to use systemd.

8. GNOME starts uses dbus to lazily start services.

9. systemd starts dbus under a separate process tree (the one under
systemd --user, as opposed to the one started by gdm).

10. GNOME notices if the user logs in twice, they start services such as
the evolution-address-book twice. Seems inefficient. They share services
between two login sessions. For some services.

11. Consequently keeping track of what session owns what process becomes
hard. Some things aren't killed properly when the sessions logout. Since
logind is tracking the sessions, seems like a good idea to make it the
systemd mob's problem. KillUserProcesses is implemented, and GNOME's
problem is solved.

12. But no one is turning KillUserProcess on so GNOME sessions are still
leaving services running. So systemd-230 changes it to default to be on.


--
|_|O|_| Registered Linux user #585947
|_|_|O| Github: https://github.com/dpurgert
|O|O|O|