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 660637 - Pending dbus method calls not canceled on connection loss
Pending dbus method calls not canceled on connection loss
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-10-01 16:36 UTC by Daniel Drake
Modified: 2011-10-07 18:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
cancel pending method calls when connection is lost (3.39 KB, patch)
2011-10-01 16:36 UTC, Daniel Drake
reviewed Details | Review

Description Daniel Drake 2011-10-01 16:36:46 UTC
Created attachment 197965 [details] [review]
cancel pending method calls when connection is lost

If the connection to the bus is lost while a method call is ongoing, the method call does not get cancelled. Instead it just sits around until it times out.

This is visible here on XO laptops when stopping the display manager during shutdown. imsettings starts sending a sync message to give up its bus name (via g_bus_unown_name()), then systemd terminates the session bus at approximately the same time. imsettings then hangs for about 20 seconds before timing out the message.

http://lists.freedesktop.org/archives/dbus/2011-September/014717.html

imsettings behaviour could be improved as described in that thread, but I think this is a glib bug. I've also come up with the attached patch which fixes it.
Comment 1 David Zeuthen (not reading bugmail) 2011-10-01 21:02:19 UTC
Hey, thanks for filing a bug about this - I really appreciate it. Any chance you can write a test case for it? If not, I'll try to whip up something when I'm back at work on Tuesday (I'm off on Monday). Thanks.
Comment 2 David Zeuthen (not reading bugmail) 2011-10-07 18:17:36 UTC
Review of attachment 197965 [details] [review]:

Patch is good except for a couple of trivial issues. I will commit it along with a test case that I just written. Thanks!

::: glib-2.30.0.orig/gio/gdbusconnection.c
@@ +1606,3 @@
+  if (remove)
+    g_warn_if_fail (g_hash_table_remove (data->connection->map_method_serial_to_send_message_data,
+                                        GUINT_TO_POINTER (data->serial)));

Should use braces since the statement spans two lines.

@@ +2216,3 @@
+{
+  SendMessageData *data = value;
+  GSource *idle_source;

This appears to be unused

@@ +2261,3 @@
     set_closed_unlocked (connection, remote_peer_vanished, error);
+    g_hash_table_foreach_remove (connection->map_method_serial_to_send_message_data, cancel_method_on_close, NULL);
+  }

Wrong indentation - braces go on separate lines.
Comment 3 David Zeuthen (not reading bugmail) 2011-10-07 18:30:36 UTC
glib-2-30: http://git.gnome.org/browse/glib/commit/?h=glib-2-30&id=3dcde986bff5b869da13ba7f3abd815ad34c1c45

master: http://git.gnome.org/browse/glib/commit/?id=3c4d3dec092609bb8e8bf77dcaea5ad9ddfb4ed3

This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.