`bzr commit` throws an exception when bzr-dbus is installed, and commit is via SSH

Bug #326320 reported by Craig Mason
4
Affects Status Importance Assigned to Milestone
D-Bus
Fix Released
Medium
bzr-dbus
Fix Released
Undecided
Unassigned
bzr-dbus (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Running `bzr commit` when logged into a machine via SSH causes a crash. Speaking with somebody in the #bzr IRC channel, it was discovered that the variable $DBUS_SESSION_BUS_ADDRESS is blank when connecting via SSH.

Running `dbus-launch bzr commit` works without crashing.

Committing to: /tmp/bzr/
added testfile
bzr: ERROR: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 2290, in run
    exclude=safe_relpath_files(tree, exclude))
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 242, in commit
    result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 197, in commit
    revprops=revprops, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/commit.py", line 407, in commit
    self.branch.set_last_revision_info(new_revno, self.rev_id)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 2096, in set_last_revision_info
    self._run_post_change_branch_tip_hooks(old_revno, old_revid)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1634, in _run_post_change_branch_tip_hooks
    hook(params)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/hook.py", line 46, in on_post_change_branch_tip
    activity.Activity().advertise_branch(params.branch)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 71, in __init__
    self.bus = _get_bus(bus)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 49, in _get_bus
    return dbus.SessionBus()
  File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 217, in __new__
    mainloop=mainloop)
  File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 106, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/var/lib/python-support/python2.5/dbus/bus.py", line 125, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.

bzr 1.6.1 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'commit']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_GB.UTF-8'
plugins:
  avahi /usr/lib/python2.5/site-packages/bzrlib/plugins/avahi [0.3.0dev0]
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.6.0]
  dbus /usr/lib/python2.5/site-packages/bzrlib/plugins/dbus [unknown]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.95.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Craig Mason (craig-mason-stasismedia) wrote :
Download full text (3.8 KiB)

Running `bzr commit` when logged into a machine via SSH causes a crash. Speaking with somebody in the #bzr IRC channel, it was discovered that the variable $DBUS_SESSION_BUS_ADDRESS is blank when connecting via SSH.

Running `dbus-launch bzr commit` works without crashing.

Committing to: /tmp/bzr/
added testfile
bzr: ERROR: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 2290, in run
    exclude=safe_relpath_files(tree, exclude))
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 242, in commit
    result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 197, in commit
    revprops=revprops, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/commit.py", line 407, in commit
    self.branch.set_last_revision_info(new_revno, self.rev_id)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 2096, in set_last_revision_info
    self._run_post_change_branch_tip_hooks(old_revno, old_revid)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1634, in _run_post_change_branch_tip_hooks
    hook(params)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/hook.py", line 46, in on_post_change_branch_tip
    activity.Activity().advertise_branch(params.branch)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 71, in __init__
    self.bus = _get_bus(bus)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 49, in _get_bus
    return dbus.SessionBus()
  File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 217, in __new__
    mainloop=mainloop)
  File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 106, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/var/lib/python-support/python2.5/dbus/bus.py", line 125, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.

bzr 1.6.1 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'commit']
encoding: 'UTF-8', fsenc: 'UT...

Read more...

Revision history for this message
Charles Duffy (M1) (cduffy-messageone) wrote :

Per discussion with Colin Walters in #dbus -- the immediate workaround is probably to short-circuit if DBUS_SESSION_BUS_ADDRESS is unset; the proper fix is probably for libdbus to avoid auto-spawning behavior if no DISPLAY variable is set.

<nDuff> Is it appropriate for an application with an optional dependency on dbus to not make any calls at all if DBUS_SESSION_BUS_ADDRESS is unset?
<walters> well...ug. You want to avoid the auto-spawning session bus?
<nDuff> there's a report in #bzr of commit operations crashing with the bzr-dbus plugin installed but without a session active
<walters> actually it looks like DBUS_SESSION_BUS_ADDRESS is in the specification (for better or worse)
<walters> so yeah, that's a reasonable thing to do
<walters> the reason i'm a little ambivalent about it is that we'd like to make the session bus per-uid which would involve some kernel tricks most likely
<nDuff> ...yar, I can see how something like an API call to check for a valid session might be more futureproof, then.
<walters> but if we do that i think we'll need to keep some compatibility with the environment variable for various reasons; so go ahead and depend on it
<walters> though i do wonder why bzr would be crashing
<nDuff> http://pastebin.com/d30394fa1
<walters> crashing as in python traceback, or crash as in native segv?
<nDuff> a Python exception
<nDuff> DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.
<walters> oh...hm.
<nDuff> ...I suppose just catching and logging the exception might be a saner approach than the environment variable, actually...
<walters> so in this situation there's no X server (i.e. no DISPLAY?)
<nDuff> correct; it's being used over a non-X-forwarding ssh session.
<walters> i'm thinking this is really a libdbus bug; we shouldn't try to auto-spawn a bus in this situation
<walters> the reason this crazy autospawning got added was for people ssh -X into their server and running an X app like firefox
<walters> we didn't want to just break firefox trying to talk to the session bus when none exists

Revision history for this message
Charles Duffy (M1) (cduffy-messageone) wrote :
Changed in bzr-dbus:
status: New → Confirmed
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 326320] [NEW] `bzr commit` throws an exception when bzr-dbus is installed, and commit is via SSH
Download full text (4.6 KiB)

This bug has already been fixed in upstream bzr-dbus as well as in
Debian. A new version should be synced into Ubuntu.

  affects bzr-dbus
  status fixreleased

  affects ubuntu/bzr-dbus
  status confirmed

On Fri, 2009-02-06 at 19:59 +0000, Craig Mason wrote:
> Public bug reported:
>
> Running `bzr commit` when logged into a machine via SSH causes a crash.
> Speaking with somebody in the #bzr IRC channel, it was discovered that
> the variable $DBUS_SESSION_BUS_ADDRESS is blank when connecting via SSH.
>
> Running `dbus-launch bzr commit` works without crashing.
>
> Committing to: /tmp/bzr/
> added testfile
> bzr: ERROR: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.
>
>
> Traceback (most recent call last):
> File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 857, in run_bzr_catch_errors
> return run_bzr(argv)
> File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
> ret = run(*run_argv)
> File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
> return self.run(**all_cmd_args)
> File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 2290, in run
> exclude=safe_relpath_files(tree, exclude))
> File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
> result = unbound(self, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 242, in commit
> result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
> result = unbound(self, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 197, in commit
> revprops=revprops, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/bzrlib/commit.py", line 407, in commit
> self.branch.set_last_revision_info(new_revno, self.rev_id)
> File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
> result = unbound(self, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 2096, in set_last_revision_info
> self._run_post_change_branch_tip_hooks(old_revno, old_revid)
> File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1634, in _run_post_change_branch_tip_hooks
> hook(params)
> File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/hook.py", line 46, in on_post_change_branch_tip
> activity.Activity().advertise_branch(params.branch)
> File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 71, in __init__
> self.bus = _get_bus(bus)
> File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 49, in _get_bus
> return dbus.SessionBus()
> File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 217, in __new__
> mainloop=mainloop)
> File "/var/lib/python-support/python2.5/dbus/_dbus.py", line 106, in __new__
> bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
> File "/var/lib...

Read more...

Changed in bzr-dbus:
status: Confirmed → Fix Released
Changed in dbus:
status: Unknown → Confirmed
Revision history for this message
In , Hp-pobox (hp-pobox) wrote :

Makes sense.

Jelmer Vernooij (jelmer)
Changed in bzr-dbus (Ubuntu):
status: Confirmed → Fix Released
Changed in dbus:
importance: Unknown → Medium
Changed in dbus:
importance: Medium → Unknown
Changed in dbus:
importance: Unknown → Medium
Changed in dbus:
status: Confirmed → In Progress
Changed in dbus:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.