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 747745 - media-keys dysfunctional after resuming from suspend
media-keys dysfunctional after resuming from suspend
Status: RESOLVED NOTGNOME
Product: gnome-settings-daemon
Classification: Core
Component: media-keys
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
: 746777 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-04-12 16:25 UTC by pufuo
Modified: 2016-08-03 20:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Output of gnome-settings-daemon -r (2.06 KB, text/plain)
2015-04-13 12:21 UTC, pufuo
Details
Valgrind output (5.02 KB, text/plain)
2015-06-04 13:51 UTC, pufuo
Details
gdb breakpoints on gsd_device_get_device_type() (5.37 KB, text/plain)
2015-06-23 08:57 UTC, Hubert Hesse
Details

Description pufuo 2015-04-12 16:25:02 UTC
When resuming from suspend (s2r), all keybindings under org.gnome.settings-daemon.plugins.media-keys stop working. Other keybindings still work. After a reboot, everything works again.
Comment 1 Bastien Nocera 2015-04-13 09:01:31 UTC
Did you check whether gnome-settings-daemon was still running? Or if it's somehow unresponsive? In both cases, a backtrace of the crash or hang would be appreciated.
Comment 2 pufuo 2015-04-13 12:21:03 UTC
Created attachment 301454 [details]
Output of gnome-settings-daemon -r

Thanks for your reply. There are always two instances of gnome-settings-daemon running, one instance as the user "gdm" and one as a normal user. Restarting gnome-settings-daemon does not seem to have an effect on this bug.

You can find the output of gnome-settings-daemon -r in the attached textfile. Let me know if you need any additional information.
Comment 3 Rui Matos 2015-04-13 12:47:10 UTC
Which distro is this on? We've had another bug report with the same symptoms and the reporter says it stopped happening with GNOME 3.16 . See bug 745753
Comment 4 pufuo 2015-04-13 13:39:50 UTC
This is happening on Ubuntu 15.04 with the GNOME 3 PPA (3.16). It's indeed a duplicate of bug 745753.

The output of "dbus-monitor --session --profile | grep ^sig" and xev is the same as in the other bug report. Nothing gets logged by gsd when I press any of the non-functioning keybindings (like Ctrl+Alt+T and XF86AudioLowerVolume).
Comment 5 Michael Gratton 2015-04-23 02:04:40 UTC
I can confirm this on Ubuntu 15.04 with the GNOME 3 PPA.
Comment 6 Michael Gratton 2015-04-23 02:27:05 UTC
After looking into this further, I'm getting the same results as the reporter:

 * Logging from from xev and are dbus-monitor the same as bug 745753
 * Nothing is logged after launching gsd in debug mode

However, I noticed that launching gsd with --replace didn't actually replace the the instance started at login. So I tried sending a SIGTERM to it with no result - it was only terminated after sending a SIGKILL. It was then automatically restarted (by gnome-session? systemd?) and media keys (and my lock screen shortcut) started working again.

After then running `gsd --debug --replace` once more, my session was terminated and I had to log back in.

Note this is with systemd used as process 1.
Comment 7 Michael Gratton 2015-04-24 00:49:31 UTC
According to strace, after resuming from suspend and un-SIGTERM'able, it's stuck in a futex:

> futex(0x7fda2e102568, FUTEX_WAIT_PRIVATE, 421, NULL

This is the stack gdb reports at this point:

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #2 g_once_init_enter
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #3 gsd_device_get_type
    from /usr/lib/gnome-settings-daemon-3.0/libxrandr.so
  • #4 gsd_device_get_device_type
    from /usr/lib/gnome-settings-daemon-3.0/libxrandr.so
  • #5 ??
    from /usr/lib/gnome-settings-daemon-3.0/libxrandr.so
  • #6 g_closure_invoke
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #7 ??
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #8 g_signal_emit_valist
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #9 g_signal_emit_by_name
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #10 ??
    from /usr/lib/gnome-settings-daemon-3.0/libgsdwacom.so
  • #11 g_closure_invoke
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #12 ??
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #13 g_signal_emit_valist
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #14 g_signal_emit_by_name
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #15 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #16 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #17 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #18 gdk_display_get_event
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #19 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #20 g_main_context_dispatch
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #21 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #22 g_main_loop_run
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #23 gtk_main
    from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
  • #24 main

Comment 8 Bastien Nocera 2015-04-24 00:56:29 UTC
(In reply to Michael Gratton from comment #7)
> According to strace, after resuming from suspend and un-SIGTERM'able, it's
> stuck in a futex:
> 
> > futex(0x7fda2e102568, FUTEX_WAIT_PRIVATE, 421, NULL
> 
> This is the stack gdb reports at this point:

Can you install the debug version of the glib and gnome-settings-daemon packages and get the gdb output again?
Comment 9 Michael Gratton 2015-04-24 04:08:06 UTC
I worked out how to reproduce this with gsd 3.16.1:

1. Suspend with an external USB keyboard/mouse plugged in
2. When it has suspended, unplug the keyboard
3. Wake the computer

Media keys and other gsd-managed shortcuts will no longer work.

Stack trace with gsd and glib debugging symbols:

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at /build/buildd/glib2.0-2.44.0/./glib/gthread-posix.c line 1401
  • #2 g_once_init_enter
    at /build/buildd/glib2.0-2.44.0/./glib/gthread.c line 649
  • #3 gsd_device_get_type
    at gsd-device-manager.c line 63
  • #4 gsd_device_get_device_type
    at gsd-device-manager.c line 300
  • #5 manager_device_removed
    at gsd-xrandr-manager.c line 1179
  • #9 <emit signal 0x80 <error: Cannot access memory at address 0x80> on instance 0x1ccbea0 [GsdX11DeviceManager]>
    at /build/buildd/glib2.0-2.44.0/./gobject/gsignal.c line 3401
  • #10 remove_device
    at gsd-device-manager-x11.c line 140
  • #14 <emit signal 0x80 <error: Cannot access memory at address 0x80> on instance 0x1b0fed0 [GdkX11DeviceManagerXI2]>
    at /build/buildd/glib2.0-2.44.0/./gobject/gsignal.c line 3401
  • #15 0x00007efe6e1adc2f in
  • #16 0x00007efe6e1b5e62 in
  • #17 0x00007efe6e1b58f9 in
  • #18 gdk_display_get_event
  • #19 0x00007efe6e1b5572 in
  • #20 g_main_context_dispatch
    at /build/buildd/glib2.0-2.44.0/./glib/gmain.c line 3122
  • #21 g_main_context_dispatch
    at /build/buildd/glib2.0-2.44.0/./glib/gmain.c line 3737
  • #22 g_main_context_iterate
    at /build/buildd/glib2.0-2.44.0/./glib/gmain.c line 3808
  • #23 g_main_loop_run
    at /build/buildd/glib2.0-2.44.0/./glib/gmain.c line 4002
  • #24 gtk_main
  • #25 main
    at main.c line 425

Comment 10 Bruno Cartolari Esteves 2015-05-31 22:32:59 UTC
I can confirm this and add that in my case even shortcuts like Ctrl-Alt-T doesn't work any more (although the basic ones for window manipulation still works).
For me it's a matter of locking the screen, and unlocking it.
After the screen is unlocked all of the shortcuts stop working.
Comment 11 Bastien Nocera 2015-06-04 11:59:27 UTC
Problem looks to be somewhere in the GsdDeviceManager.

Any chance you could move away the gnome-settings-daemon binary:
mv /usr/lib/gnome-settings-daemon/gnome-settings-daemon /usr/lib/gnome-settings-daemon/gnome-settings-daemon.bak

Kill the running instance:
killall -9 gnome-settings-daemon (ignore the errors)

Run the daemon under valgrind:
valgrind /usr/lib/gnome-settings-daemon/gnome-settings-daemon.bak

Reproduce the problem, and send the output of that tool to us. I'd also need to know the exact version of gnome-settings-daemon.

(Don't forget to move the binary back in its place, and reboot to clean up that state).
Comment 12 pufuo 2015-06-04 13:51:00 UTC
Created attachment 304583 [details]
Valgrind output

Thank you for the instructions. Valgrind didn't give any output when suspending or resuming from suspend; see the attachment. This is running gsd 3.16.2-0ubuntu1~vivid1 from GNOME 3 PPA.
Comment 13 Bastien Nocera 2015-06-04 13:57:41 UTC
This is what's causing everything to hang:
(gnome-settings-daemon.bak:16757): GLib-GObject-WARNING **: cannot register existing type 'GsdDeviceManager'

(gnome-settings-daemon.bak:16757): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(gnome-settings-daemon.bak:16757): common-plugin-CRITICAL **: gsd_device_manager_list_devices: assertion 'GSD_IS_DEVICE_MANAGER (manager)' failed

You'll probably want to ask Ubuntu GNOME to review the patches they're using in their PPA, because we haven't seen that particular error on other distributions.
Comment 14 Simon Law 2015-06-04 18:50:10 UTC
I have linked this bug to Launchpad: https://bugs.launchpad.net/gnome-settings-daemon/+bug/1427877
Comment 15 Hubert Hesse 2015-06-23 08:57:25 UTC
Created attachment 305899 [details]
gdb breakpoints on gsd_device_get_device_type()
Comment 16 Hubert Hesse 2015-06-23 09:11:45 UTC
Hi there, I'm on also on the PPA facing the same issue. The error Bastien describes in #13 is not the root cause for me (The "GSD_IS_DEVICE_MANAGER" message appears way earlier in the initialization phase, but the media keys still work fine afterwards). 

I recompiled the ubuntu ppa package gnome-settings-daemon from source. Stripped the Debian Patches. Then I added some printf debugging, since I know nothing about the gnome code base, and changed gsd-xrandr-manager.c->manager_device_removed to

void
manager_device_removed (GsdXrandrManager *manager,
                        GsdDevice        *device)
{
        GsdDeviceType type;

        g_debug("here removed");
        type = gsd_device_get_device_type (device);

        if ((type & GSD_DEVICE_TYPE_TOUCHSCREEN) == 0)
                return;
        g_debug("here removed2");
        gsd_device_mapper_remove_input (manager->priv->device_mapper, device);
}

As you can see in #15 g_debug("here removed2") is never printed. So maybe something about the wiring of the singal/emit mechanism of ("device-removed", "device-added") is broken? In any case it leads to:


(gnome-settings-daemon:5635): GLib-GObject-WARNING **: cannot register existing type 'GsdDevice'

(gnome-settings-daemon:5635): GLib-GObject-WARNING **: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(gnome-settings-daemon:5635): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

Unfortunately I could not identify where those logs lines come from. Maybe you can give me some pointers so I can investigate further?


The issue is also triggered when adding an external monitor.
Comment 17 Joe Barnett 2015-06-24 15:17:37 UTC
removing the touchscreen conditional/return does seem to fix the hotkey issue.  I don't have any touchscreen devices though so not sure what it might break.
Comment 18 Hubert Hesse 2015-06-24 22:31:44 UTC
Not for my ThinkPad Extra Buttons (Fn/Vol+/Vol-) :(

But the manager_device_removed function is named very misleading or there is an error in !(type & GSD_DEVICE_TYPE_TOUCHSCREEN)) This holds true for non Touchscreen devices right? So only touchscreen devices are removed and added (manager_device_added has the same statement).

So I changed the code to:
        g_debug("here removed");
        type = gsd_device_get_device_type (device);
        g_debug("%s", g_type_name(G_TYPE_FROM_INSTANCE(device)));
        g_debug("device: %s %u %u", G_TYPE_FROM_INSTANCE(device), type, GSD_DEVICE_TYPE_TOUCHSCREEN);
        g_debug("%u", type & GSD_DEVICE_TYPE_TOUCHSCREEN);

I get the following output:

(gnome-settings-daemon:32578): xrandr-plugin-DEBUG: here removed

(gnome-settings-daemon:32578): GLib-GObject-WARNING **: cannot register existing type 'GsdDevice'

(gnome-settings-daemon:32578): GLib-GObject-WARNING **: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(gnome-settings-daemon:32578): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(gnome-settings-daemon:32578): common-plugin-CRITICAL **: gsd_device_get_device_type: assertion 'GSD_IS_DEVICE (device)' failed
(gnome-settings-daemon:32578): xrandr-plugin-DEBUG: GsdDevice
(gnome-settings-daemon:32578): xrandr-plugin-DEBUG: device: \u0008 0 16
(gnome-settings-daemon:32578): xrandr-plugin-DEBUG: 0
(gnome-settings-daemon:32578): xrandr-plugin-DEBUG: here removed2

So GSD_IS_DEVICE fails for a GsdDevice. Unfortunately I don't know enough about GObject. Is it possible that there are competing definitions? I saw there is duplicate code and definitions in https://github.com/GNOME/gnome-control-center/blob/1cd186eaad29dd44fb1cbc71212655f5dc5c1edb/panels/common/gsd-device-manager.h .. Also after this happens I cannot change the brightness in the control panel. So maybe this an indicator as well.
Comment 19 Hubert Hesse 2015-06-24 22:50:20 UTC
Unfortunately I don't see where gsd_device_get_type (the function behind GSD_IS_DEVICE) is implemented, so I can compare why its failing to recognize the GsdDevice at hand.
Comment 20 Joe Barnett 2015-06-25 18:03:51 UTC
hmm... on further inspection, it fixes it only temporarily.  enough unplug/replug of monitor and the hotkeys stop working again.
Comment 21 Bastien Nocera 2015-06-26 07:47:45 UTC
(In reply to Bastien Nocera from comment #13)
> This is what's causing everything to hang:
> (gnome-settings-daemon.bak:16757): GLib-GObject-WARNING **: cannot register
> existing type 'GsdDeviceManager'
> 
> (gnome-settings-daemon.bak:16757): GLib-CRITICAL **: g_once_init_leave:
> assertion 'result != 0' failed
> 
> (gnome-settings-daemon.bak:16757): common-plugin-CRITICAL **:
> gsd_device_manager_list_devices: assertion 'GSD_IS_DEVICE_MANAGER (manager)'
> failed
> 
> You'll probably want to ask Ubuntu GNOME to review the patches they're using
> in their PPA, because we haven't seen that particular error on other
> distributions.

If the problem isn't due to Ubuntu's PPA patches, then it might be Ubuntu's compilation and/or linking flags. You should really report this downstream, it doesn't happen on anything but Ubuntu...
Comment 22 Hubert Hesse 2015-06-26 10:33:38 UTC
So, I can confirm building gnome-settings-daemon from vanilla source does indeed leave the media-keys intact. (Not a workaround though, now back-light hotkeys want gksudo permission.) Taking it back to the Ubuntu bug tracker.

git clone git@github.com:GNOME/gnome-settings-daemon.git
cd gnome-settings-daemon
git checkout GNOME_SETTINGS_DAEMON_3_16_2
git submodule init
git submodule update
./autogen.sh
./configure
make
/usr/local/libexec/gnome-settings-daemon -r --debug
Comment 23 Bastien Nocera 2015-06-26 12:13:23 UTC
Great, thanks a lot for testing. I'll let you bring this bug back to Launchpad.
Comment 24 darkxst 2015-06-28 02:42:16 UTC
This was caused by linking with -Wl, -BSymbolic-functions, which for some reason seem to break the sharing of type info between plugins.

Apparently it seems no other distro's link with this flag, but just noting it here in case others hit the same issue
Comment 25 Bastien Nocera 2016-08-03 20:10:51 UTC
*** Bug 746777 has been marked as a duplicate of this bug. ***