GNOME Bugzilla – Bug 774452
shutdown dialog does not open in time
Last modified: 2016-11-17 13:06:32 UTC
Invoking Ctrl-Alt-Del, shutdown dialog shows up always delay 1 to 2 seconds.
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.
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.
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.
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.
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>
I took authorship of the patch, as I needed to completely rewrite the changelog, and fix the review comments I mentioned above.
Attachment 340133 [details] pushed as 21fb652 - media-keys: Fix shutdown dialog delay when using kbd shortcut