GNOME Bugzilla – Bug 660637
Pending dbus method calls not canceled on connection loss
Last modified: 2011-10-07 18:30:36 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.
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.
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.
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.