DBUS_SESSION_BUS_ADDRESS related Qs.

Havoc Pennington hp at redhat.com
Wed Feb 28 14:31:54 PST 2007


Hi,

Krishna R wrote:
> I see that doing a dbus-launch sets a different address for 
> DBUS_SESSION_BUS_ADDRESS everytime. How do i make is use a pre-defined 
> address all the time?
> I am wondering if dbus dies and i relaunch it i dont have to worry about 
> the env for DBUS_SESSION_BUS_ADDRESS since it will use the same address 
> again.

This won't work, generally speaking. I think you can set the <listen> 
address in session.conf to have path= instead of tmpdir= or something 
like that. But if the bus dies all the apps connected to it will be 
hosed, so you have to restart the session anyway. The bus defines the 
session; when the bus dies, the session is toast.

> 2.
> If the above is possible and the bus address can be kept the same. If 
> dbus session daemon is restarted what will happen for an existing 
> connection that has set itself some filter func?

Apps are not supposed to survive when the session bus exits, since the 
session bus's lifetime defines the lifetime of the session. i.e. the 
session bus dying indicates that the user has logged out.

> 3.
> How do applications in general handle the dbus-daemon crashing or dying 
> unexpectedly?

They exit, because the bus exit is assumed to mean logout.

To survive across session bus exit, apps would need another "grounding 
point" - that is, a way to regroup themselves into a session that was 
not the session bus. Another way to put it, is that all the apps would 
need to reconnect to the *same* session bus.

Ways to locate the session bus include:
  - env variable - doesn't solve this because it can't be changed later
  - X server property - doesn't solve this due to nongraphical
    apps/daemons
  - file in homedir - doesn't solve this due to
    locking/network-file-system problems

Also of course to restart the session bus something would have to 
restart it, but the bus is the "root" of the session generally so 
there's nothing to restart the bus itself.

Anyway, the paradox is that the session bus enables all other 
application-daemon pairs to work this way - the app can easily restart 
the daemon it's talking to, using the session bus as a way to locate the 
daemon and restart it. But the session bus daemon itself can't work this 
way afaik.

Just as the kernel and init are special for the whole system, the 
session bus, X server, and session manager are special for an individual 
user session.

Havoc


More information about the dbus mailing list