Bug#895150: cinnamon-screensaver-command: Crashes and hangs when unable to grab the keyboard/mouse
Package: cinnamon-screensaver
Version: 3.6.1-2
Severity: important
Dear Maintainer,
I use cinnamon-screensaver-command to automatically lock my screen from a
custom script I created.
I found out that if cinnamon-screensaver-command crashes, it never returns,
making my script unable to proceed.
Here's a way to reproduce the issue:
Run the following in for example, a gnome-terminal:
$ sleep 10 ; echo "locking..." ; cinnamon-screensaver-command -l ; echo "Should
do something else now."
Before you see "locking..." in the console, click "File" in the terminal's
window or some other window.
After the 10 seconds, I notice the window losing focus in what seems to be
cinnamon-screensaver-command trying to lock the screen.
After some more seconds, I get the following stack trace in the terminal:
Traceback (most recent call last):
File "/usr/share/cinnamon-screensaver/cinnamon-screensaver-command.py", line
73, in on_client_ready
self.perform_action()
File "/usr/share/cinnamon-screensaver/cinnamon-screensaver-command.py", line
90, in perform_action
self.client.proxy.call_lock_sync(self.message)
GLib.Error: g-io-error-quark: Timeout was reached (24)
The last echo is never printed and you'll have to press Ctrl+C to exit.
I see the following in cinnamon-screensaver's log:
.....
couldn't grab keyboard
couldn't grab keyboard
couldn't grab keyboard
couldn't grab keyboard
couldn't grab keyboard
couldn't grab keyboard
couldn't grab keyboard
couldn't grab keyboard
couldn't grab mouse
couldn't grab mouse
couldn't grab mouse
couldn't grab mouse
.....
Note that this issue is about the behaviour of cinnamon-screensaver-command
after a crash: because it does not return, calling scripts are unable to tell
there was a failure and deal with it (even if by just retrying later).
Can we make cinnamon-screensaver-command return with an error code instead of
hanging in cases like this?
Please see #895149 for the security implications I see on the behaviour for
cinnamon-screensaver that originally triggered this specific crash.
Thanks and best regards,
Luís Picciochi Oliveira
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.15.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages cinnamon-screensaver depends on:
ii cinnamon-desktop-data 3.6.2-2
ii gir1.2-accountsservice-1.0 0.6.45-1
ii gir1.2-cinnamondesktop-3.0 3.6.2-2
ii gir1.2-gkbd-3.0 3.26.0-3
ii gir1.2-glib-2.0 1.56.0-2
ii gir1.2-gtk-3.0 3.22.29-2
ii gir1.2-xapp-1.0 1.0.4-2
ii iso-flags-png-320x240 1.0.1-1
ii libc6 2.27-3
ii libcscreensaver0 3.6.1-2
ii libglib2.0-0 2.56.0-4
ii libgtk-3-0 3.22.29-2
ii python3 3.6.4-1
ii python3-gi 3.28.1-1
ii python3-gi-cairo 3.28.1-1
ii python3-setproctitle 1.1.10-1+b1
ii python3-xapp 1.0.1-1
ii python3-xlib 0.20-3
Versions of packages cinnamon-screensaver recommends:
pn cinnamon-screensaver-x-plugin <none>
Versions of packages cinnamon-screensaver suggests:
pn cinnamon-screensaver-webkit-plugin <none>
-- no debconf information
Reply to: