Freeze when receiving a keypress from a different input device than the last keypress
[only exists on Xorg]
- Reproduction Steps:
- Get two keyboards or any input source able to send keypresses
- press some keys on both simultaneously
- Notice as long as you keep doing it, everything will be frozen
Attaching GDB to gnome-shell and reproducing the issue shows keymap_changed() is called each time it receives a keypress by a different input from the last one.
Calling it once seem to be enough to produce a very short freeze you would only notice when playing a game, but calling it quickly many times produces a continuous freeze.
Here is the backtrace when switching from one key input to a different one:
#0 0x00007f6b34718c21 in poll () at /usr/lib/libc.so.6
#1 0x00007f6b2f084630 in () at /usr/lib/libxcb.so.1
#2 0x00007f6b2f085fef in () at /usr/lib/libxcb.so.1
#3 0x00007f6b2f086103 in xcb_wait_for_reply ()
at /usr/lib/libxcb.so.1
#4 0x00007f6b2f0c2b0a in xkb_x11_get_core_keyboard_device_id
() at /usr/lib/libxkbcommon-x11.so.0
#5 0x00007f6b33552a9b in meta_backend_x11_get_keymap
(backend=<optimized out>)
at backends/x11/meta-backend-x11.c:638
#6 0x00007f6b3357dbc9 in reload_modmap
(keys=keys@entry=0x560d172fa168) at core/keybindings.c:234
#7 0x00007f6b3358039d in reload_keybindings
(display=0x560d172fa020) at core/keybindings.c:1123
#8 0x00007f6b341f916e in g_signal_emit_valist ()
at /usr/lib/libgobject-2.0.so.0
#9 0x00007f6b341f9762 in g_signal_emit_by_name ()
at /usr/lib/libgobject-2.0.so.0
#10 0x00007f6b3355328b in keymap_changed
(backend=0x560d1640d130)
at backends/x11/meta-backend-x11.c:303
#11 0x00007f6b3355328b in handle_host_xevent
(event=0x7ffca6aec1a0, backend=0x560d1640d130)
at backends/x11/meta-backend-x11.c:356
#12 0x00007f6b3355328b in x_event_source_dispatch
(source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at backends/x11/meta-backend-x11.c:436
#13 0x00007f6b3411b3cf in g_main_context_dispatch ()
at /usr/lib/libglib-2.0.so.0
#14 0x00007f6b3411cf89 in () at /usr/lib/libglib-2.0.so.0
#15 0x00007f6b3411df62 in g_main_loop_run ()
at /usr/lib/libglib-2.0.so.0
#16 0x00007f6b33582acc in meta_run () at core/main.c:689
#17 0x0000560d15c5e782 in main
(argc=<optimized out>, argv=<optimized out>)
at ../gnome-shell/src/main.c:501
Arch Linux 4.18.19-lqx
gnome-shell 3.30.2
mutter 3.30.2
Edited by Térence Clastres