Bug 266931

Summary: dbus-daemon does not end with users sessions and has many instances for each user
Product: [openSUSE] openSUSE 10.3 Reporter: Andreas Pfaller <andreas.pfaller>
Component: X11 ApplicationsAssignee: Timo Hoenig <thoenig>
Status: RESOLVED FIXED QA Contact: Stefan Dirsch <sndirsch>
Severity: Normal    
Priority: P5 - None CC: andreas.pfaller, behlert, gjeilers, werner
Version: RC 1   
Target Milestone: RC 1   
Hardware: x86-64   
OS: openSUSE 10.2   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: "ps axu" output
ps axu of opensuse 10.2 system with lots of dbus deamons
"ps axu" output
"ps axu" while logged in

Description Andreas Pfaller 2007-04-23 07:36:36 UTC
Note: This is a duplicate of bug #158098 but any attempt to add an
additional comment or change the product to 10.2 gets rejected with

  "You are not permitted to edit bugs in product SUSE LINUX 10.0."


This problem described in #158098 certainly still exists in 10.2.
I have just killed a few dozen dbus-daemon's on a system with
only 3 remote X sessions from thin clients and 1 local X login.
Comment 1 Timo Hoenig 2007-04-27 10:16:03 UTC
Andreas, can you please provide the complete list of processes running (ps axu) whenever you run into that issue?  Thanks!
Comment 2 Andreas Pfaller 2007-04-27 16:21:36 UTC
Created attachment 135979 [details]
"ps axu" output

Freshly booted 10.2 install. I logged in and out
of a fairly standard KDE session 3 times on the
local X display (:0). Note that for each login a
dbus-daemon gets left behind.
Comment 3 Timo Hoenig 2007-04-27 19:06:37 UTC
Andreas, thanks for the process list.  It looks quite sane -- I can not see any orphan process using D-Bus.

Do you happen to have GNOME on your system installed, too?  If so, could you please check whether the same happens if you use GNOME sessions instead of KDE?

Thanks!
Comment 4 Andreas Pfaller 2007-04-28 00:43:30 UTC
Gnome is not installed on the system I send you the ps output 
(comment #2) from. However a different system has both KDE and Gnome
installed and on this system the same happens for both desktop
environments.

I am surprised that you can't seem to reproduce this since at least
all of my systems show the same problem and they are quite different
systems (Opterons, Athlons, and Intel - all dualcore and 64bit)
and for all user accounts I tested (including a minimal KDE
session setup configured with kiosktool). Each session logout
leaves one addiontal dbus-daemon running (100% reproduceable).

I have all relevant updates from the 10.2 update tree installed
but I am not sure if this already happend with the original
DVD install (The server where my thin clients connect only
went into production recently and unlike my normal desktops
this server sees many temporary X sessions so the many
dbus-daemons are really noticeable in the ps output).
Comment 5 jef peeraer 2007-05-02 17:50:01 UTC
Created attachment 137085 [details]
ps axu of opensuse 10.2 system with lots of dbus deamons

Linux jwt 2.6.18.8-0.1-bigsmp #1 SMP Fri Mar 2 13:51:59 UTC 2007 i686 athlon i386 GNU/Linux
-> system runs daily 30 users. the output is when everybody is logged out
->kde is used as default window manager
Comment 6 George Eilers 2007-05-26 20:53:27 UTC
I consistently see the same behavior on at least two different i86 systems, one of them with a fresh install.
Comment 7 George Eilers 2007-06-01 15:27:42 UTC
The problem appears to originate in gdm--even when using the KDE desktop--because gdm is used for KDE as long as the GNOME desktop is installed.  When I forced the use of kdm by setting DISPLAYMANAGER=kdm in /etc/sysconfig and rebooted, all of the spurious instances of dbus-daemon disappeared.
Comment 8 George Eilers 2007-06-01 15:34:09 UTC
Sorry for the false lead.  I forgot that rebooting would eliminate the spurious dbus-daemon instances.  The problem appears with kdm as well.
Comment 9 George Eilers 2007-06-03 16:46:36 UTC
The problem is caused by loss of the environment variable DBUS_SESSION_BUS_ADDRESS between ending a desktop session and starting a new one.  In the case of KDE at least, this can be fixed by saving the value in a per-session file immediately after the session dbus-daemon is created and restoring it when a new session is started.

You can do that by adding the following lines near the beginning of /opt/kde3/bin/startkde:

  # Save the current dbus session bus address
  echo $DBUS_SESSION_BUS_ADDRESS >~/.dbus-session-bus-address

You also need to add the following line before the part of /etc/X11/xinit/xinitrc.common that tests for and starts a session dbus-daemon:

  # Restore the dbus session bus address if any
  test -r ~/.dbus-session-bus-address && \
       read DBUS_SESSION_BUS_ADDRESS <~/.dbus-session-bus-address
  export DBUS_SESSION_BUS_ADDRESS

There is probably something similar that would work for gnome desktops.

A much better solution would be to prevent the environment variable from getting cleared in the first place, but I have not been able to find the code that executes when a desktop session is closed.

This bug is NOT specific to x86-64 hardware as reported.
Comment 10 Timo Hoenig 2007-06-11 11:46:01 UTC
Thanks a lot for investigating, George.

Werner, can you please read through the last comments and share your opinion how we should proceed?  Thanks!
Comment 11 Dr. Werner Fink 2007-06-11 14:17:05 UTC
IMHO saving the DBUS_SESSION_BUS_ADDRESS variable is much better done
shortly after the dbus sessin is started.  Before this pointer the
file should be readed from the file and if there is no session a new
one should be started otherwise the old should be used be exporting
the existing value.  This is similar to what I doing for gpg-agent
within /etc/X11/xdm/sys.xsession  ... and please avoid using /opt/kde3/bin/startkde I'd like to see this feature also for GNOME
and other desktops and even for normal window manaagers.
Comment 12 Timo Hoenig 2007-08-08 08:59:35 UTC
George, did you have a chance to check whether this issue remains with 10.3?  I can not reproduce it on 10.3 Alpha 7.
Comment 13 Timo Hoenig 2007-09-25 12:24:50 UTC
No reply within more than 4 weeks, fixed in 10.3, marking as FIXED.
Comment 14 Andreas Pfaller 2007-10-10 07:45:29 UTC
Problem still exists in 10.3 final (tested only with kde).
Comment 15 Timo Hoenig 2007-10-10 12:56:11 UTC
Andreas, can you please send the output of 'ps axu' after killing the session?

Thank you. 
Comment 16 Andreas Pfaller 2007-10-10 13:42:09 UTC
Created attachment 177403 [details]
"ps axu" output

I have just found out that my other 10.3 system does not
show the problem. However it occurs on my (new installed)
main system which has /home copied from the previous 10.2
install. However I see nothing in the "ps axu" output
which explains the symptom. The "ps axu output was obtained
from a freshly booted systems after 4 login & logouts.
Comment 17 Timo Hoenig 2007-10-10 13:54:15 UTC
Probably it is because dbus-launch is not being used?  What does the output of 'ps axu' look like when you're logged in?

There's probably something fishy in your user configuration somewhere in $HOME/.kde .
Comment 18 Andreas Pfaller 2007-10-10 14:27:03 UTC
Created attachment 177424 [details]
"ps axu" while logged in

Well I already removed everything from ".kde/Autostart" and
".kde/env" but the problem remains. This time the "ps axu"
output is after the 3rd login.
Comment 19 Andreas Pfaller 2007-10-13 16:38:44 UTC
OK, I found some time to investigate this issue.
It turns out that my old home directory contained an outdated
"~/.xinitrc" so the new version in "/etc/X11/xinit/" was not
used. After removing it the issue disappeared.