After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 530615 - bonobo-activation-server should be tied to session
bonobo-activation-server should be tied to session
Status: RESOLVED FIXED
Product: bonobo
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Michael Meeks
bonobo qa
Depends on:
Blocks:
 
 
Reported: 2008-04-29 19:21 UTC by Ray Strode [halfline]
Modified: 2008-05-07 14:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
connect to session bus (2.01 KB, patch)
2008-04-29 19:23 UTC, Ray Strode [halfline]
none Details | Review
Make bonobo-activation-server per session instead of per user (10.30 KB, patch)
2008-05-06 21:12 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2008-04-29 19:21:53 UTC
So almost every Fedora release there is a bug somewhere in some applet or daemon that uses bonobo-activation-server where bonobo-activation-server gets stuck around after log out.  This causes hell to ensue on the subsequent login.

These bugs aren't normally bugs in bonobo-activation-server, per se, and they need to be fixed, but it does highlight a bigger issue.

bonobo-activation-server should be tied to the user's session.  It shouldn't be allowed to stick around after the user's session because the only thing that use it are things in the user's session.
Comment 1 Ray Strode [halfline] 2008-04-29 19:23:52 UTC
Created attachment 110123 [details] [review]
connect to session bus

One idea is to connect bonobo-activation-server to the session bus, so it will automatically exit when the session exits.

This isn't the only conceivable way to tie it to the session, but it's an easy way.

(Note it's not as nice as it could be because it doesn't let bonobo-activation-server go down its clean up path)
Comment 2 Michael Meeks 2008-05-02 09:00:09 UTC
Agreed - we had a nasty regression here IMHO when we moved from 'GOAD' back pre Gnome 2.0 :-)

The basic idea of a per-system service for a per-session thing is basically stupid :-)

Having said that - unfortunately, if you log in twice: sadly you can re-use the same b-a-s (if only by accident).


So - what to do: I like the general approach: but I'd really like to go further.

If we make libbonobo depend on dbus: I'd like to hollow out bonobo-activation, and the activation daemon: and make them normal per-session dbus services.

Perhaps we should still use CORBA for the existing APIs in the 1st pass; but we need to re-hash all the 'DISPLAY' handling and other nastiness [ though this may impact multi-display issues rather unpleasantly, which would suck ].

Hmm ;-)

Perhaps the simplest thing to do is to ensure we propagage DBUS_SESSION_BUS_ADDRESS from each client to the daemon [ there is code to do this already for other env. vars ], and then ensure we connect [ as your patch does ] to each possible session bus, and then cleanup when they are all gone.

How does that sound ?
Comment 3 Ray Strode [halfline] 2008-05-02 14:25:08 UTC
So my thoughts:
 - If we go with the connect to multiple sessions idea, my approach isn't really sufficient.  It will need to set_exit_on_disconnect (FALSE), watch for the Disconnected signal of each bus connection and only exit when all sessions exit.  May be should do the listen-for-Disconnected-signal thing anyhow though.
 - If we agree the basic idea of having a per-user instead of per-session bonobo-activation-server is misguided, we should fix it.  I don't think having one bonobo-activation-server process running to cover all running sessions for a user is useful, is it?  There's no practical advantage over having multiple bonobo-activation-server processes, one for each session, yea?
 - The multiple sessions to one user case isn't super interesting because things are already pretty broken in other ways if you try to do that.
 - I do think it probably makes sense to keep using CORBA for the existing APIs, just to minimize the potential for breaking things.
 - More generally, and in that same vein, I think it makes sense to keep our changes relatively targeted.
 - Maybe we should rename /tmp/orbit-$USER/bonobo-activation-server-ior to /tmp/orbit-$USER/bonobo-activation-server-$DBUS_SESSION_BUS_ADDRESS-ior (and similarly for the lock file).  

What do you think?
Comment 4 Michael Meeks 2008-05-02 17:11:09 UTC
Sounds like you're on top of it to me Ray :-)
My only concern is that the 'screen' mangled into the DISPLAY should get across the wire & be propagated to a new applet say on screen 1.

In fact, forget that - I can't recall the constraints we should be keeping: if you can re-hack it, and test it in some multi-head setups: I'm happy :-) go for it. Pleased to have you involved: [ and yes, keeping the CORBA API for using the daemon itself is prolly a good plan for now ].
Comment 5 Ray Strode [halfline] 2008-05-06 21:12:28 UTC
Created attachment 110482 [details] [review]
Make bonobo-activation-server per session instead of per user

This patch does 4 things:

1) Exports the get_ior_fname() and get_lock_fname() functions from libbonobo-activation so that activation-server doesn't need to duplicate the logic for figuring out those names

2) Changes the implementation of those two functions to key off of the session guid from DBUS_SESSION_BUS_ADDRESS

3) incorporates the original patch in this bug report that makes activation-server connect to the session bus.  It additionally does the connect to "Disconnected" signal bits we discussed

4) adds a function to delete the ior and lock file on shutdown.  It apparently wasn't doing it before.
Comment 6 Ray Strode [halfline] 2008-05-07 00:54:28 UTC
Oh one other point I forgot to mention in earlier was, I don't think there should be any semantic shift with regard to multi-head setups between per-session and per-user activation servers, since in both cases we have one bonobo-activation-server running for all screens.

That is to say in a more than once Screen ("zaphod mode") multi-head setup there is normally one dbus-daemon to cover all Screen's, not, e.g., one dbus-daemon for 0.0 and one for 0.1.
Comment 7 Kjartan Maraas 2008-05-07 10:15:38 UTC
I'm guessing it would be good to get this tested as much as possible early on in the 2.23.x cycle? e.g. now?
Comment 8 Michael Meeks 2008-05-07 11:47:41 UTC
Ray - looks really good to me; please do commit & thanks for the fix.
Comment 9 Ray Strode [halfline] 2008-05-07 14:17:06 UTC
commmited:

2008-05-07  Ray Strode  <rstrode@redhat.com>

        * activation-server/activation-server-main.c:
        (cleanup_ior_and_lock_files), (main):
        remove ior and lock files on exit path

2008-05-07  Ray Strode  <rstrode@redhat.com>

        Make bonobo-activation-server exit when dbus session exits

        * configure.in: Require dbus and dbus-glib
        * activation-server/activation-server-main.c:
        (bus_message_handler): Check for "Disconnected" signal and
        quit mainloop upon getting it.
        (main): Get on session bus and filter for messages.

2008-05-07  Ray Strode  <rstrode@redhat.com>

        Key ior and lock filenames of dbus session guid

        * bonobo-activation/bonobo-activation-base-service.c
        (get_session_guid): New function to extract guid from
        $DBUS_SESSION_BUS_ADDRESS
        (_bonobo_activation_lock_fname_get),
        (_bonobo_activation_ior_fname_get): encode result of
        of get_session_guid () into returned filenames

2008-05-07  Ray Strode  <rstrode@redhat.com>

        Consolidate ior and lock name getter logic to one
        place to facilitate changing that logic

        * bonobo-activation/bonobo-activation-private.h:
        * bonobo-activation/bonobo-activation-base-service.c:
        (get_lock_fname), (get_ior_fname),
        (_bonobo_activation_lock_fname_get),
        (_bonobo_activation_ior_fname_get): Rename and export
        get_lock_fname and get_ior_fname.
        (rloc_file_lock), (rloc_file_check), (rloc_file_register),
        (rloc_file_unregister): adapt for renamed functions
        * activation-server/activation-server-main.c
        (dump_ior): get ior name from libbonobo-activation instead
        of hardcoding it to "bonobo-activation-server-ior"