Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 577416 - sys-apps/dbus-1.10.x: logging out from Gnome session leaves lots of processes running behind
Summary: sys-apps/dbus-1.10.x: logging out from Gnome session leaves lots of processes...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Freedesktop bugs
URL: https://bugs.freedesktop.org/show_bug...
Whiteboard:
Keywords:
: 577160 (view as bug list)
Depends on:
Blocks: 576028 577160
  Show dependency tree
 
Reported: 2016-03-14 19:22 UTC by Pacho Ramos
Modified: 2019-10-28 00:24 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
output (out,7.62 KB, text/plain)
2016-03-15 19:54 UTC, Pacho Ramos
Details
output (out,6.67 KB, text/plain)
2016-03-18 11:26 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2016-03-14 19:22:46 UTC
For some days I am suffering an strange behavior: when I logout, lots of processes from the gnome session are kept running. This causes problems when other users try to login in their accounts.

Googling a bit, I saw the same problem on Arch:
https://bbs.archlinux.org/viewtopic.php?id=204307

And I have seen that this is caused by dbus-1.10.x upgrade, if I switch back 1.8.x releases all go back to normal and processes die when logging out.

I am running systemd-228 that, supposedly, it should play well with dbus-1.10 and the --enable-user-session change :/

Thanks a lot for your help :)
Comment 1 Mike Gilbert gentoo-dev 2016-03-15 16:29:08 UTC
Can you elaborate on exactly what kind of problems these leftover processes cause?
Comment 2 Pacho Ramos gentoo-dev 2016-03-15 19:23:10 UTC
Apart of ending up with tons of processes from every user that has logged in, you can have random issues like, for example, gnome keyring misbehaving (password missing for example)
Comment 3 Mike Gilbert gentoo-dev 2016-03-15 19:31:55 UTC
Are the leftover processes part of a logind session, or are they children of the systemd --user instance?

The latter should be cleaned up once all logind sessions for the user have been ended.
Comment 4 Mike Gilbert gentoo-dev 2016-03-15 19:34:59 UTC
You can use the systemd-cgls program to see where the processes fall in the systemd cgroup hierarchy.

logind sessions will appear as "session-xxx.scope".
Comment 5 Pacho Ramos gentoo-dev 2016-03-15 19:54:47 UTC
Created attachment 428314 [details]
output

Looks like some are in the session group while others not :/

The attached file shows the output once I have logged out and, that way, you will see all the leftover processes (I am user 1001 there)
Comment 6 Mike Gilbert gentoo-dev 2016-03-15 21:23:05 UTC
Ok, so I would start with gdm-session-worker, and see if we can figure out why that process is hanging around in all of your sessions.
Comment 7 Mike Gilbert gentoo-dev 2016-03-15 21:28:32 UTC
Err, I guess that's user 101.

For user 1001, you appear to have an instance of deluged running in the background that is probably holding the session open.
Comment 8 Pacho Ramos gentoo-dev 2016-03-17 16:54:18 UTC
(In reply to Mike Gilbert from comment #7)
> Err, I guess that's user 101.
> 
> For user 1001, you appear to have an instance of deluged running in the
> background that is probably holding the session open.

It's normal that deluged keeps running, it has always behaved that way to keep downloading things and, with dbus-1.8, it wasn't preventing all the other processes for dying as soon as X exited.

Also, this same is happening to many other users in other machines that don't run deluge.

Regarding gdm-session-worker... do you think our pam files are ok? I have no idea about PAM... but that is something we carry downstream as they differ between all distributions and maybe it's prone to contain some errors :/

$ cat /etc/pam.d/gdm-launch-environment 
account     required    pam_nologin.so
account     required    pam_succeed_if.so audit quiet_success user = gdm
account     required    pam_permit.so

auth        required    pam_env.so
auth        required    pam_succeed_if.so audit quiet_success user = gdm
auth        required    pam_permit.so

password    required    pam_deny.so

-session    optional    pam_systemd.so kill-session-processes=1
session     optional    pam_keyinit.so force revoke
session     required    pam_succeed_if.so audit quiet_success user = gdm
session     required    pam_permit.so
Comment 9 Mike Gilbert gentoo-dev 2016-03-17 18:02:58 UTC
(In reply to Pacho Ramos from comment #8)
> It's normal that deluged keeps running, it has always behaved that way to
> keep downloading things and, with dbus-1.8, it wasn't preventing all the
> other processes for dying as soon as X exited.

Which other processes are you referring to?

It is normal for the processes in user@1001.scope to keep running until all sessions have been closed. I think deluged is keeping your session open. If you have linger enabled for the user in question, they may keep running until the system reboots.

With dbus-1.8, these dbus-actived processes would probably be killed when dbus-daemon dies due to losing its DISPLAY; with dbus-1.10, dbus-daemon is not tied to an X11 DISPLAY, so it does not get killed when X gets killed.

As for the other processes in session-13.scope: I am unfamiliar with ibus, so I don't know how it is supposed to behave.
Comment 10 Mike Gilbert gentoo-dev 2016-03-17 18:03:50 UTC
(In reply to Mike Gilbert from comment #9)
> It is normal for the processes in user@1001.scope to keep running until all
> sessions have been closed.

Sorry, this should say user@1001.service, not user@1001.scope.
Comment 11 Pacho Ramos gentoo-dev 2016-03-18 11:16:23 UTC
Other processes like pulseaudio, gconf, all the evolution subprocesses, gvfs, ibus... :/
Comment 12 Pacho Ramos gentoo-dev 2016-03-18 11:26:34 UTC
Created attachment 428490 [details]
output

This is the output on a different system, in this case with no deluge at all (a system that, with dbus-1.8, was leaving 0 processes behind when logging out)
Comment 13 Pacho Ramos gentoo-dev 2016-03-18 11:30:02 UTC
All works properly (i.e, all leftover processes die) if I manually kill the dbus-daemon that is supposedly launched by system, I mean, the one that runs with this options:
pacho     1794  1.3  0.1  32424  4128 ?        Ss   12:28   0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation
Comment 14 Mike Gilbert gentoo-dev 2016-03-18 13:59:40 UTC
(In reply to Pacho Ramos from comment #13)
> All works properly (i.e, all leftover processes die) if I manually kill the
> dbus-daemon that is supposedly launched by system, I mean, the one that runs
> with this options:
> pacho     1794  1.3  0.1  32424  4128 ?        Ss   12:28   0:00
> /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile
> --systemd-activation

Right, so the other processes are killed by accident when their bus connection is terminated.

I think this is just a difference in how dbus user-sessions are designed; dbus is no longer tied to a single login session.

For what it's worth, I don't have this problem with KDE 5; it seems to properly terminate all processes in my login session, which causes systemd --user and its children to terminate when it is no longer neeed.

I think the bug here is in GNOME and/or ibus.
Comment 15 Mike Gilbert gentoo-dev 2016-03-24 00:38:48 UTC
I did a little playing around, and the behavior is little different than what I was guessing. Random processes like deluged will not keep the session open.

I'm honestly not quite sure what is happening with GNOME. I'll have to look into what actually causes user@%i.service to stop.
Comment 16 Pacho Ramos gentoo-dev 2016-03-24 13:54:40 UTC
I have just reported to gnome-session upstream (gnome-session should take care of handling the logout process), hopefully they will give some light (as dbus upstream is still quiet :S)
https://bugzilla.gnome.org/show_bug.cgi?id=764146
Comment 17 Pacho Ramos gentoo-dev 2016-03-28 08:40:12 UTC
As I see in:
https://bugs.freedesktop.org/show_bug.cgi?id=94508
https://bugzilla.gnome.org/show_bug.cgi?id=764146

It seems that we should probably hard disable user-sessions as it seems we need to make more changes to properly support it... anyway I will still wait for more replies and information in upstream report (action is now taking care in the dbus bug... for the case you want to follow it :))
Comment 18 Pacho Ramos gentoo-dev 2016-03-28 08:43:04 UTC
Ah, and from "systemd" point of view, maybe this feature request also serves as a good summary :)
https://github.com/systemd/systemd/issues/2900
Comment 19 Mike Gilbert gentoo-dev 2016-03-28 15:19:30 UTC
(In reply to Pacho Ramos from comment #17)
> It seems that we should probably hard disable user-sessions as it seems we
> need to make more changes to properly support it...

Let's add a USE flag for it; it works well enough for some use cases.

I would say we disable it by default, and allow users to opt-in. If we want to enable it in specific profiles (like plasma/systemd) that's another option I will leave to the relevant maintainers.
Comment 20 Mike Gilbert gentoo-dev 2016-03-28 21:57:50 UTC
I added a "user-session" USE flag to 1.10.8-r1. Please give it a shot.

If that works for you, I guess the same change can be applied to 1.10.6, which has been stabilized on amd64 (again).

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=268ebcded3db897d3cc8a5fe860c453503f8304c
Comment 21 Pacho Ramos gentoo-dev 2016-04-02 11:53:37 UTC
Thanks, I will try as soon as possible. Anyway, looking to bug 577842 I would disable it completely for now as the way it breaks reverse deps is a bit "unpredictable", I mean, it's hard to know a reverse dep will break at *runtime* and also, looking that this problems are still present and randomly appearing for so many months that some distributions are shipping this, makes me thing this is not mature enough :/

Other options could be to:
- rely on having it use.masked by default
- Show a warning when the USE flag is enabled to hint the users about the kind of problems they could suffer (this would be my preferred option as a compromise for letting people to test this setup but ensure they know the consequences).

My main point is to prevent issues like cairo[xlib-xcb] (bug #508232), that causes people to hit some random bugs and being a bit hard to remember that they care caused by that (I remember a libreoffice presentation bug that was a bit unintuitive to think about cairo[xlib-xcb] being the culprit)
Comment 22 Pacho Ramos gentoo-dev 2016-04-02 12:34:02 UTC
Also, last time I checked, kdbus was being entirely redone, then, I am not sure if testing this way of launching dbus-daemon will really help as it's (again) a bit unpredictable what will finally happen on that side :/
Comment 23 Pacho Ramos gentoo-dev 2016-04-03 12:38:35 UTC
[master 357fcd2] sys-apps/dbus: Warn people about the potential breakages they could get when enabling user-session (#577416#c21)
 1 file changed, 12 insertions(+)
Comment 24 Pacho Ramos gentoo-dev 2016-04-03 12:54:03 UTC
(In reply to Mike Gilbert from comment #20)
> I added a "user-session" USE flag to 1.10.8-r1. Please give it a shot.
> 
> If that works for you, I guess the same change can be applied to 1.10.6,
> which has been stabilized on amd64 (again).
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=268ebcded3db897d3cc8a5fe860c453503f8304c

It works fine, but I would stabilize 1.10.8-r1 directly instead of backporting to 1.10.6
Comment 25 Mike Gilbert gentoo-dev 2016-04-03 16:26:41 UTC
(In reply to Pacho Ramos from comment #24)
> It works fine, but I would stabilize 1.10.8-r1 directly instead of
> backporting to 1.10.6

That should be fine; 1.10.8 has been in the tree ~26 days, so you can probably go ahead and create that stablereq.
Comment 26 Pacho Ramos gentoo-dev 2016-04-03 17:38:49 UTC
done, it's bug 578946 ;)
Comment 27 Pacho Ramos gentoo-dev 2016-12-01 12:08:25 UTC
*** Bug 577160 has been marked as a duplicate of this bug. ***
Comment 28 Pacho Ramos gentoo-dev 2017-03-02 11:50:33 UTC
(In reply to Pacho Ramos from comment #18)
> Ah, and from "systemd" point of view, maybe this feature request also serves
> as a good summary :)
> https://github.com/systemd/systemd/issues/2900
Comment 29 Pacho Ramos gentoo-dev 2017-03-02 11:51:58 UTC
(In reply to Pacho Ramos from comment #18)
> Ah, and from "systemd" point of view, maybe this feature request also serves
> as a good summary :)
> https://github.com/systemd/systemd/issues/2900

This lead to the switch of KillUserProcesses= to yes by default in upstream side... but this was reverted downstream to not break screen, tmux... hence, this is still a problem for us :/
Comment 30 Andreas Sturmlechner gentoo-dev 2019-02-24 09:42:08 UTC
Can we assume this fixed as of 3.24.2?
Comment 31 Pacho Ramos gentoo-dev 2019-02-24 09:53:05 UTC
I am unsure if all fixes were incorporated to 3.24:
https://bugzilla.gnome.org/show_bug.cgi?id=764029#c35
Comment 32 Matt Turner gentoo-dev 2019-06-29 06:02:49 UTC
Fixed as of 3.30 probably?