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 780405 - main: Start the manager only after we're sure we own the DBus name
main: Start the manager only after we're sure we own the DBus name
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-03-22 15:20 UTC by Rui Matos
Modified: 2017-03-22 18:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
main: Start the manager only after we're sure we own the DBus name (1.65 KB, patch)
2017-03-22 15:20 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2017-03-22 15:20:45 UTC
This is the real culprit beyond bug 780362
Comment 1 Rui Matos 2017-03-22 15:20:49 UTC
Created attachment 348508 [details] [review]
main: Start the manager only after we're sure we own the DBus name

This closes a race where the clients we spawn wouldn't be able to
reach us on the well known DBus name because they'd attempt to do so
before we own it.

By registering DBus APIs on the bus acquired callback but only
starting the GsmManager on name acquired we guarantee that clients
will be able to reach us.
Comment 2 Ray Strode [halfline] 2017-03-22 18:08:50 UTC
Review of attachment 348508 [details] [review]:

yup, looks right. One thing that's important is that we continue to register the manager object with the bus before we take the name, so there's never a point where we're on the bus but don't advertise e.g. /org/gnome/SessionManager   It looks like we do continue to do that in on_bus_acquired as part of gsm_manager_new/register_manager so I think the way you split up on_bus_acquired and on_name_acquired is optimal.
Comment 3 Rui Matos 2017-03-22 18:21:22 UTC
Yes, I went through the GsmManager initialization steps to make sure
we still register all of the DBus api before owning the name.

Attachment 348508 [details] pushed as 076d2e7 - main: Start the manager only after we're sure we own the DBus name