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 708765 - D-Bus-activated keyring-daemon remains even when its bus terminates
D-Bus-activated keyring-daemon remains even when its bus terminates
Status: RESOLVED FIXED
Product: gnome-keyring
Classification: Core
Component: general
3.10.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks: 708766
 
 
Reported: 2013-09-25 16:01 UTC by Travis Reitter
Modified: 2014-03-11 16:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
daemon: exit on D-Bus disconnection (711 bytes, patch)
2013-11-12 16:18 UTC, Allison Karlitskaya (desrt)
needs-work Details | Review
daemon: Exit gnome-keyring-daemon when the DBus connection closes (8.66 KB, patch)
2014-03-06 17:43 UTC, Stef Walter
committed Details | Review

Description Travis Reitter 2013-09-25 16:01:41 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.
Comment 1 Allison Karlitskaya (desrt) 2013-11-12 16:18:28 UTC
Created attachment 259673 [details] [review]
daemon: exit on D-Bus disconnection
Comment 2 Stef Walter 2013-11-12 19:17:17 UTC
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.
Comment 3 Dmitry Shachnev 2014-01-28 13:31:57 UTC
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.
Comment 4 Stef Walter 2014-03-06 17:43:02 UTC
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.
Comment 5 Stef Walter 2014-03-06 17:47:27 UTC
Attachment 271126 [details] pushed as 6361138 - daemon: Exit gnome-keyring-daemon when the DBus connection closes
Comment 6 Dmitry Shachnev 2014-03-06 17:55:03 UTC
Thanks a lot for fixing this!