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 618882 - No way to ensure that a message is sent
No way to ensure that a message is sent
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other All
: Normal major
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-05-17 14:35 UTC by Allison Karlitskaya (desrt)
Modified: 2010-07-07 19:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Allison Karlitskaya (desrt) 2010-05-17 14:35:07 UTC
near as i can tell, there is no way to ensure that a GDBus message has been sent unless you wait for the reply.

this is a problem for commandline tools like "gsettings set" that just send the message off and exit immediately without running the mainloop and without allowing a chance for the worker thread to do the work for sending the message off.

in libdbus we have a flush() method on the connection to handle this.  perhaps we could have this in GDBus too?  perhaps we could have a somewhat higher-level API for this?

in some ways this could be consider a GSettings bug; in fact, i very nearly added a g_settings_sync() API to wait until all outstanding writes had come back, but i think it would be generally useful to have a way of making sure a message that you've sent is actually sent, as a GDBus-level feature.
Comment 1 David Zeuthen (not reading bugmail) 2010-05-17 16:58:20 UTC
Sure, we should probably add g_dbus_connection_flush{,_finish,_sync}() for this.

It's a little involved implementing this: we need to poke the worker thread so it drains the work queue and flushes the underlying GIOStream (which itself has sync and async versions).

> in some ways this could be consider a GSettings bug; in fact, i very nearly
> added a g_settings_sync() API to wait until all outstanding writes had come
> back, but i think it would be generally useful to have a way of making sure a
> message that you've sent is actually sent, as a GDBus-level feature.

I agree flush() is a feature and that you shouldn't need it in GSettings because flush() on GDBusConnection will only guarantee that the message is on the way to the peer (typically a message bus daemon instance), not that it gets any further. And the message may be blocked at several junctures on its journey to the destination. Presumably the code that you want to speak to using GDBus may reject the request by returning a D-Bus error or whatever, I don't know how GSettings work.

That said, I'm not opposed to adding flush().
Comment 2 David Zeuthen (not reading bugmail) 2010-07-07 19:04:43 UTC
OK, added _flush{_finish,sync}():

http://git.gnome.org/browse/glib/commit/?id=62a1ccf526e7b23ac39cdf7251eac5706eef3f57