[gnome-session/wip/stop-dbus-daemon: 2/2] Stop dbus-daemon instead of restarting it




commit 0484e0a1d6b4562b603b9ffccc943a3e1bf6dd3e
Author: Simon McVittie <smcv collabora com>
Date:   Thu Dec 3 12:39:20 2020 +0000

    Stop dbus-daemon instead of restarting it
    
    On systems where dbus-daemon is a systemd user service, it is always
    socket-activatable, so it will be restarted on-demand by dbus.socket.
    On systems where it is not, neither StopUnit nor TryRestartUnit will
    do anything.
    
    If the job contradicts jobs that are already queued, fail with a warning
    instead of replacing those jobs.
    
    This should avoid a deadlock experienced by some users during system
    shutdown, in which dbus.service is queued to be stopped, but then
    gnome-session restarts it, resulting in `systemd --user` continuing to
    run for an additional 90 seconds, until systemd-as-pid-1 loses patience
    and kills it.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 gnome-session/gsm-manager.c | 4 ++--
 tools/gnome-session-ctl.c   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 6839a02df..a15d21761 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -977,8 +977,8 @@ maybe_restart_user_bus (GsmManager *manager)
                                              "org.freedesktop.systemd1",
                                              "/org/freedesktop/systemd1",
                                              "org.freedesktop.systemd1.Manager",
-                                             "TryRestartUnit",
-                                             g_variant_new ("(ss)", "dbus.service", "replace"),
+                                             "StopUnit",
+                                             g_variant_new ("(ss)", "dbus.service", "fail"),
                                              NULL,
                                              G_DBUS_CALL_FLAGS_NONE,
                                              -1,
diff --git a/tools/gnome-session-ctl.c b/tools/gnome-session-ctl.c
index 8d94f8447..eb9d6b5f8 100644
--- a/tools/gnome-session-ctl.c
+++ b/tools/gnome-session-ctl.c
@@ -127,10 +127,10 @@ do_restart_dbus (void)
                                              SYSTEMD_DBUS,
                                              SYSTEMD_PATH_DBUS,
                                              SYSTEMD_INTERFACE_DBUS,
-                                             "TryRestartUnit",
+                                             "StopUnit",
                                              g_variant_new ("(ss)",
                                                             "dbus.service",
-                                                            "replace"),
+                                                            "fail"),
                                              NULL,
                                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
                                              -1, NULL, &error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]