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 774452 - shutdown dialog does not open in time
shutdown dialog does not open in time
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: plugins
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2016-11-15 04:52 UTC by xiaoguang wang
Modified: 2016-11-17 13:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
plugins: send shutdown message by asynchronous (2.35 KB, patch)
2016-11-15 05:29 UTC, xiaoguang wang
needs-work Details | Review
plugins: shutdown dialog does not open in time (3.39 KB, patch)
2016-11-17 02:44 UTC, xiaoguang wang
none Details | Review
media-keys: Fix shutdown dialog delay when using kbd shortcut (2.80 KB, patch)
2016-11-17 13:04 UTC, Bastien Nocera
committed Details | Review

Description xiaoguang wang 2016-11-15 04:52:59 UTC
Invoking Ctrl-Alt-Del, shutdown dialog shows up always delay 1 to 2 seconds.
Comment 1 xiaoguang wang 2016-11-15 05:25:26 UTC
After sending CTL+ALT+DEL key,  from journal log you can get

"WARNING:Client '/org/gnome/SessionManager/Client4' failed to reply
 before timeout"

After get this WARNING, shutdown dialog appears. From d-feet
tool, you can find '/org/gnome/SessionManager/Client4' is
gnome-setting-daemon.

The normal dbus message process of opening shutdown dialog should be:
1. gnome-setting -> gnome-session   'path=/org/gnome/SessionManager;
interface=org.gnome.SessionManager; member=Shutdown'
2. gnome-session -> gnome-setting
'path=/org/gnome/SessionManager/Client4;
interface=org.gnome.SessionManager.ClientPrivate;
member=QueryEndSession'
3. gnome-setting -> gnome-session (delay timeout)
'path=/org/gnome/SessionManager/Client4;
interface=org.gnome.SessionManager.ClientPrivate;
member=EndSessionResponse'
4. gnome-session -> gnome-shell
'path=/org/gnome/SessionManager/EndSessionDialog;
interface=org.gnome.SessionManager.EndSessionDialog; member=Open'

You can not get message 3, and this cause timeout warning, and one
second delay.

gnome-setting-daemon send message 1 with g_dbus_proxy_call_sync
function. It is Synchronous method to send message, gnome-setting-daemon
will wait for the reply. But gnome-session send message 2 to
gnome-setting-daemon to end session, gnome-setting-daemon can't send
reply now.

gnome-setting-daemon need to use g_dbus_proxy_call to send message 1, asynchronous method is better.
Comment 2 xiaoguang wang 2016-11-15 05:29:18 UTC
Created attachment 339880 [details] [review]
plugins: send shutdown message by asynchronous

Using g_dbus_proxy_call_sync to send shutdown message will cause
shutdown dialog showing up delay.

Use g_dbus_proxy_call to send shutdown message.
Comment 3 Bastien Nocera 2016-11-16 12:37:09 UTC
Review of attachment 339880 [details] [review]:

> plugins: send shutdown message by asynchronous

This doesn't explain what the commit fixes.

> Using g_dbus_proxy_call_sync to send shutdown message will cause
> shutdown dialog showing up delay.

Explain why.

> Use g_dbus_proxy_call to send shutdown message.

This is unnecessary, the code already shows that.

::: plugins/media-keys/gsd-media-keys-manager.c
@@ +824,3 @@
+                                           res,
+                                           &error);
+        if (result == NULL) {

Need to check for a cancelled call.

@@ +842,3 @@
+        g_dbus_proxy_call (proxy,
+                           "Shutdown",
+                           NULL,

Need to use a cancellable.
Comment 4 xiaoguang wang 2016-11-17 02:44:52 UTC
Created attachment 340100 [details] [review]
plugins: shutdown dialog does not open in time

After sending CTL+ALT+DEL key, shutdown dialog open always delay 1 to
2 seconds.

The normal dbus message process of opening shutdown dialog should be:
1. gnome-setting -> gnome-session   'path=/org/gnome/SessionManager;
interface=org.gnome.SessionManager; member=Shutdown'
2. gnome-session -> gnome-setting
'path=/org/gnome/SessionManager/Client4;
interface=org.gnome.SessionManager.ClientPrivate;
member=QueryEndSession'
3. gnome-setting -> gnome-session (delay timeout)
'path=/org/gnome/SessionManager/Client4;
interface=org.gnome.SessionManager.ClientPrivate;
member=EndSessionResponse'
4. gnome-session -> gnome-shell
'path=/org/gnome/SessionManager/EndSessionDialog;
interface=org.gnome.SessionManager.EndSessionDialog; member=Open'

gnome-setting-daemon send message 1 with g_dbus_proxy_call_sync
function. It is Synchronous method to send message, gnome-setting-daemon
wait for the reply. gnome-session send message 2 to
gnome-setting-daemon, gnome-setting-daemon can't reply now.
gnome-session don't receive message 3, and after one second timeout
gnome-session send out message 4.

gnome-setting-daemon need to use asynchronous method to send message 1,
then gnome-setting-daemon can reply message 2.
Comment 5 Bastien Nocera 2016-11-17 13:04:16 UTC
Created attachment 340133 [details] [review]
media-keys: Fix shutdown dialog delay when using kbd shortcut

After pressing the Ctrl+Alt+Del shortcut, the shutdown dialog doesn't
appear on screen for a couple of seconds.

The media-keys daemon calls the 'Shutdown' method synchronously. After that
gnome-session calls the daemon with 'QueryEndSession'. The daemon cannot
reply as it's blocked waiting for the reply to the Shutdown method.

Sending the message asynchronously fixes that delay.

Based on report by Xiaoguang Wang <xwang@suse.com>
Comment 6 Bastien Nocera 2016-11-17 13:05:27 UTC
I took authorship of the patch, as I needed to completely rewrite the changelog, and fix the review comments I mentioned above.
Comment 7 Bastien Nocera 2016-11-17 13:06:21 UTC
Attachment 340133 [details] pushed as 21fb652 - media-keys: Fix shutdown dialog delay when using kbd shortcut