GNOME Bugzilla – Bug 708765
D-Bus-activated keyring-daemon remains even when its bus terminates
Last modified: 2014-03-11 16:40:25 UTC
It's convention for D-Bus-activated processes to exit when they lose their D-Bus connection. This is in part to keep the process tree clean of defunct daemons (especially since they should generally be single-instance. Most D-Bus-dependent daemons exit in case their bus connection is lost even if they weren't D-Bus-activated (since they depend heavily upon it). The Folks EDS backend tests end up spawning many instances of gnome-keyring-daemon which never exit because they ignore the termination of the private D-Bus session bus we create for our tests. All other processes which get launched during these test runs gracefully exit when we kill the D-Bus daemon. Stef pointed out that it might make sense to have gnome-keyring-daemon exit if it's D-Bus-activated, in which case it has the --components=secrets argument (which sets it in a specific mode) and does not have an accompanying ssh or gpg agent. So the goal of this bug is to produce a patch that meets that requirement.
Created attachment 259673 [details] [review] daemon: exit on D-Bus disconnection
Review of attachment 259673 [details] [review]: Thanks for the patch. It makes sense to merge something like this early on in the 3.11 cycle, so that people can see if it affects them in some unforseen way. That said ... we can't just exit(1) the daemon. Please do an orderly shutdown. You can see how SIGTERM is handled for guidance here.
As I understand it, to set the disconnect handler one can: - use g_dbus_connection_signal_subscribe to subscribe to “Disconnected” signal on the local interface; - pass name_lost_handler to g_dbus_own_name. However, gnome-keyring-daemon seems to not use any GDBus API, and I am not sure if there is any API for that in libdbus. Do you know any? I would really like to see this bug fixed as it currently prevents us in Debian/Ubuntu from running tests for gnome-keyring and some other packages.
Created attachment 271126 [details] [review] daemon: Exit gnome-keyring-daemon when the DBus connection closes We don't do this via the standard mechanism, as it means that libdbus just calls _exit() (not even exit()) when the connection goes away. This can lead to inconsistent state. Shutdown should be orderly.
Attachment 271126 [details] pushed as 6361138 - daemon: Exit gnome-keyring-daemon when the DBus connection closes
Thanks a lot for fixing this!