[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#897221: Session logout doesn't TERMinate all processes



¡Hola Didier!

El 2018-06-06 a las 19:38 +0200, Didier 'OdyX' Raboud escribió:
Please check loginctl session-status <id> (The id can be obtained with
loginctl list-sessions)

I noticed it also appears when disconnecting, and reconnecting back. Akonadi
is then broken, etc etc.

Hereattached is a log of the processes from a stopped session. It really feels
like plasma doesn't stop its child processes from the systray either.

	    Unit: session-3.scope
		  ├─ 2690 /usr/lib/postgresql/9.6/bin/postgres -D /home/didier/.local/share/akonadi/db_data -k/tmp/akonadi-didier.bR0FSO -h
		  ├─ 2695 postgres: checkpointer process
		  ├─ 2696 postgres: writer process
		  ├─ 2697 postgres: wal writer process
		  ├─ 2698 postgres: autovacuum launcher process
		  ├─ 2699 postgres: stats collector process
		  ├─ 2955 /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-immediately

I've noticed that at-spi-bus-launcher won't close when the session finishes, I've seen this behaviour in cinnamon also. You might want to try killing it and checking if that reduces the amount of waiting processes.

		  ├─ 2976 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
		  ├─ 2986 /usr/bin/perl /usr/bin/parcimonie-applet
		  ├─ 3083 /usr/bin/python3 /usr/bin/hp-systray -x

I would expect these two to die "gracefully" when there is no X connection. Are these two zombies? Is plasmashell still running? Is X still running?

		  ├─ 3086 /usr/bin/python3 /usr/bin/hp-systray -x
		  ├─ 3920 /usr/lib/x86_64-linux-gnu/libexec/kf5/kio_http_cache_cleaner

I'm sure this one will go away on its own.

		  ├─20252 postgres: didier akonadi [local] idle
		  ├─20277 postgres: didier akonadi [local] idle
		  ├─20278 postgres: didier akonadi [local] idle
		  ├─20507 postgres: didier akonadi [local] idle
		  ├─20509 postgres: didier akonadi [local] idle
		  ├─20792 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session

The --use-gnome-session here seems wrong.

		  ├─21250 postgres: didier akonadi [local] idle
		  ├─21252 postgres: didier akonadi [local] idle
		  ├─21318 postgres: didier akonadi [local] idle
		  └─21377 postgres: didier akonadi [local] idle

There is no akonadi process in this list, but a postgres running with your user (for akonadi purposes), I don't think they are even started by akonadi. You might want to migrate this db to a pgcluster configuration, so it's independent of your login session.

In any case you might want to keep checking the output of loginctl session-status <id> and killing the "offending" processes till you have a minimal set of processes that are not being correctly stopped.

I wonder if at-spi-bus-launcher and postgres would behave "better" if set as a systemd user service.

Mmh, this is a complex problem. Debian systemd reverts the default logind
configuration KillUserProcesses, that effectively terminates the session
when the user logs out, and most desktop environments assume this is set to
it's default value, so they don't have to deal with the processes started
by systemd --user, which, by the way, the desktop environment had nothing
to do with.

Also, kde does nothing to remember which processes were started as autostart
desktop files.

Gnome "fixes" this by terminating the logind session, as if
KillUserProcesses was set, at the cost of breaking tmux and screen (which is
the reason why Debian reverts the KillUserProcesses setting on the first
place).

So, either we need to fix tmux and screen to they can be detached from the
logind session, or fix the kde concept of session so it matches better what
logind expects.

The first alternative looks like the correct thing to do to me. So a route to
fix this is for systemd to revert the KillUserProcesses back to upstream's
default, right? This was apparently last reinforced in systemd 234-3 and was
discussed in #825394.

But it doesn't seem like this would gather consensus currently. How hard is it
to get KDE to grow better login session processes handling?

Well, at least the the ksmserver/startup.cpp launches the autostart desktop files with a QProcess::startDetached call, this would need to be refactor so the processes are waited and notified on shutdown.

There are probably other places where a process ends up being part of the logind session, but I guess this should be a good start.

Happy hacking,
--
"Fighting patents one by one will never eliminate the danger of software patents, any more than swatting mosquitoes will eliminate malaria."
-- Richard M. Stallman
Saludos /\/\ /\ >< `/

Attachment: signature.asc
Description: PGP signature


Reply to: