Opened 11 years ago

Closed 11 years ago

#1401 closed defect (fixed)

s-p-s exits if system bus cannot be accessed

Reported by: sascha_silbe Owned by: sascha_silbe
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: sugar-presence-service Version: Git as of bugdate
Severity: Major Keywords: r+
Cc: tomeu Distribution/OS: Unspecified
Bug Status: New

Description

psutils.py already fails gracefully if NetworkManager cannot be found, but it breaks if the entire session bus is unreachable (e.g. because of running inside a chroot environment):

1253468327.196359 INFO s-p-s: Starting presence service 0.85.3...
Traceback (most recent call last):
  File "/home/sascha.silbe/sugar-jhbuild/install/bin/sugar-presence-service", line 24, in <module>
    main.main()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/main.py", line 64, in main
    presenceservice.main(test_num, randomize)
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/presenceservice.py", line 885, in main
    ps = PresenceService()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/presenceservice.py", line 87, in __init__
    self._owner = self._create_owner()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/presenceservice.py", line 56, in _create_owner
    return ShellOwner(self, self._session_bus)
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/buddy.py", line 992, in __init__
    tags=tags)
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/buddy.py", line 680, in __init__
    self._ip4_addr_monitor = psutils.IP4AddressMonitor.get_instance()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/psutils.py", line 151, in get_instance
    _ip4am = IP4AddressMonitor()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar-presence-service/psutils.py", line 162, in __init__
    self._sys_bus = dbus.SystemBus()
  File "/usr/lib/pymodules/python2.5/dbus/_dbus.py", line 202, in __new__
    private=private)
  File "/usr/lib/pymodules/python2.5/dbus/_dbus.py", line 108, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/pymodules/python2.5/dbus/bus.py", line 125, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
1253468327.227770 DEBUG root: _cleanup_temp_files

Since the shell breaks if it cannot reach the presence service, Sugar won't work at all without a system bus running, even though it's only required for optional features (non-permanent connection to jabber server, removable media):

1253468325.289580 ERROR root: Keypair exists, skip generation.
1253468326.440811 ERROR dbus.proxies: Introspect error on org.laptop.Sugar.Presence:/org/laptop/Sugar/Presence: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1
1253468326.442057 DEBUG dbus.proxies: Executing introspect queue due to error
1253468327.290424 ERROR sugar.presence.presenceservice: Unable to retrieve local user/owner from presence service
Traceback (most recent call last):
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/sugar/presence/presenceservice.py", line 443, in get_owner
    owner_op = self._ps.GetOwner()
  File "/usr/lib/pymodules/python2.5/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/pymodules/python2.5/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/pymodules/python2.5/dbus/connection.py", line 622, in call_blocking
    message, timeout)
DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1
Traceback (most recent call last):
  File "/home/sascha.silbe/sugar-jhbuild/install/bin/sugar-session", line 225, in <module>
    main()
  File "/home/sascha.silbe/sugar-jhbuild/install/bin/sugar-session", line 194, in main
    start_ui_service()
  File "/home/sascha.silbe/sugar-jhbuild/install/bin/sugar-session", line 95, in start_ui_service
    ui_service.start()
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/view/service.py", line 59, in start
    owner_model = owner.get_model()
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/model/owner.py", line 112, in get_model
    _model = Owner()
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/model/owner.py", line 77, in __init__
    self._invites = Invites()
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/jarabe/model/invites.py", line 78, in __init__
    owner = ps.get_owner()
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/sugar/presence/presenceservice.py", line 447, in get_owner
    raise RuntimeError("Could not get owner object.")
RuntimeError: Could not get owner object.
1253468327.350193 DEBUG root: _cleanup_temp_files

Attachments (2)

0001-fail-gracefully-if-system-DBus-unreachable-1401.patch (2.9 KB) - added by sascha_silbe 11 years ago.
fail gracefully if system DBus unreachable
1401.patch (3.3 KB) - added by sascha_silbe 11 years ago.
fail gracefully if system DBus unreachable

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by sascha_silbe

fail gracefully if system DBus unreachable

comment:1 follow-up: Changed 11 years ago by sascha_silbe

  • Keywords r? added
  • Owner changed from tomeu to sascha_silbe
  • Status changed from new to accepted

Need to test on a system with a system bus (with and without NM running), but we can already start review.

comment:2 in reply to: ↑ 1 Changed 11 years ago by tomeu

  • Keywords r! added; r? removed

Replying to sascha_silbe:

Need to test on a system with a system bus (with and without NM running), but we can already start review.

I like the patch, please test and put it again in the review queue. Thanks!

Changed 11 years ago by sascha_silbe

fail gracefully if system DBus unreachable

comment:3 Changed 11 years ago by sascha_silbe

  • Cc tomeu added
  • Keywords r? added; r! removed

Rebased and tested, please review.

comment:4 Changed 11 years ago by tomeu

  • Keywords r+ added; r? removed

Great, thanks!

comment:5 Changed 11 years ago by sascha_silbe

I don't have commit rights for s-p-s; can you either add me or commit it, please?

comment:6 Changed 11 years ago by sascha_silbe

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.