[sugar] python activities startup

Tomeu Vizoso tomeu
Fri Feb 8 08:44:24 EST 2008


On Fri, 2008-02-08 at 13:41 +0100, Tomeu Vizoso wrote:
> On Thu, 2008-02-07 at 16:46 +0000, Simon McVittie wrote:
> > A better solution would be for Rainbow to avoid SessionBus() entirely,
> > and instead use an instance of the superclass, dbus.bus.BusConnection. This
> > does not have the weird caching behaviour at all (one call to the
> > constructor = one instance = one D-Bus connection). The code that gets run
> > after forking is still free to use the shared SessionBus.
> 
> Rainbow is not using the session bus at all, just the system one.
> 
> But when the child tries to instantiate a SessionBus object, I get this stack trace:
> 
> /usr/lib/python2.5/site-packages/sugar/presence/presenceservice.py in __init__(self=<PresenceService object at 0x86afbbc (sugar+presence+presenceservice+PresenceService at 0x86f1370)>, allow_offline_iface=False)
>      73 
>      74         # Get a connection to the session bus
> ---> 75         self._bus = dbus.SessionBus()
>         self._bus = undefined
>         global dbus.SessionBus = <class 'dbus._dbus.SessionBus'>
>      76         self._bus.add_signal_receiver(self._name_owner_changed_cb,
>      77                                     signal_name="NameOwnerChanged",
> 
> /usr/lib/python2.5/site-packages/dbus/_dbus.py in __new__(cls=<class 'dbus._dbus.SessionBus'>, private=False, mainloop=None)
>     211         """
>     212         return Bus.__new__(cls, Bus.TYPE_SESSION, private=private,
> --> 213                            mainloop=mainloop)
>         mainloop = None
>     214 
>     215 class StarterBus(Bus):
> 
> /usr/lib/python2.5/site-packages/dbus/_dbus.py in __new__(cls=<class 'dbus._dbus.SessionBus'>, bus_type=0, private=False, mainloop=None)
>     100             raise ValueError('invalid bus_type %s' % bus_type)
>     101 
> --> 102         bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
>         bus = undefined
>         global BusConnection.__new__ = <function __new__ at 0x822733c>
>         subclass = <class 'dbus._dbus.SessionBus'>
>         bus_type = 0
>         mainloop = None
>     103 
>     104         bus._bus_type = bus_type
> 
> /usr/lib/python2.5/site-packages/dbus/bus.py in __new__(cls=<class 'dbus._dbus.SessionBus'>, address_or_type=0, mainloop=None)
>     123 
>     124     def __new__(cls, address_or_type=TYPE_SESSION, mainloop=None):
> --> 125         bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
>         bus = undefined
>         cls._new_for_bus = <built-in method _new_for_bus of type object at 0x8256f44>
>         address_or_type = 0
>         mainloop = None
>     126 
>     127         # _bus_names is used by dbus.service.BusName!
> 
> <class 'dbus.exceptions.DBusException'>: org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-7dk02BRXOZ: Connection refused
> 
> 
> This is the value of the DBUS_SESSION_BUS_ADDRESS env var:
> unix:path=/tmp/olpc-session-bus,guid=fdf37ebd35a585d12382a50047ac3034
> 
> unix:path=/tmp/olpc-session-bus is specified
> in /etc/dbus-1/session-olpc.conf:
> 
> <busconfig>
>   <!-- Our well-known bus type, don't change this -->
>   <type>session</type>
> 
>   <listen>unix:path=/tmp/olpc-session-bus</listen>
> 
>   <standard_session_servicedirs />
> ...

When running inside rainbow, strace shows this:

[pid  2370] connect(0, {sa_family=AF_FILE, path=@/tmp/dbus-XQcfxlvcoY}, 23) = -1 ECONNREFUSED (Connection refused)

But on the console (works fine):

connect(3, {sa_family=AF_FILE, path="/tmp/olpc-session-bus"}, 23) = 0

Tomeu




More information about the Sugar-devel mailing list