Bug 1428280 - Wayland: spurious key repeat with gtk 3.22.9 in gnome-terminal
Summary: Wayland: spurious key repeat with gtk 3.22.9 in gnome-terminal
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gtk3 (Show other bugs)
(Show other bugs)
Version: 25
Hardware: Unspecified Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Clasen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-02 08:18 UTC by Olivier Fourdan
Modified: 2017-04-28 19:50 UTC (History)
4 users (show)

Fixed In Version: gtk3-3.22.9-2.fc25
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-03-06 02:51:34 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
events.log generated from gnome-terminal-server (219.95 KB, text/plain)
2017-04-28 06:24 UTC, Dave Johnston
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
GNOME Bugzilla 779374 None None None 2017-03-02 08:18 UTC
GNOME Bugzilla 781896 None None None 2017-04-28 12:46 UTC

Description Olivier Fourdan 2017-03-02 08:18:28 UTC
Description of problem:

gtk+3.22.9 contains a bug with key repeat, keys won't stop repeating sometimes.

This is mostly seen in gnome-terminal, but the actual bug is in gtk3.

Version-Release number of selected component (if applicable):

gtk3-3.22.9 on f25 and f26

How reproducible:

Randomly

Steps to Reproduce:

1. Open a new terminal in g-t with key combo ctrl-shift-n

Actual results:

Key press start being repeated in gnome-terminal

Expected results:

Key press are repeated only when the key is kept depressed.

Additional info:

This is a regression introduced by my patch for upstream bug 778019 [1].

Good news is we have a fix upstream [2] see bug 779374 [3]

[1] https://bugzilla.gnome.org/show_bug.cgi?id=778019
[2] https://bugzilla.gnome.org/attachment.cgi?id=346921
[3] https://bugzilla.gnome.org/show_bug.cgi?id=779374

Comment 1 Kalev Lember 2017-03-02 09:11:50 UTC
Thanks Olivier. I've backported this to gtk3-3.22.9-2.fc25 and gtk3-3.22.9-2.fc26 and gtk3-3.22.9-2.fc27

Comment 2 Fedora Update System 2017-03-02 09:13:29 UTC
gtk3-3.22.9-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-ce763afcbe

Comment 3 Fedora Update System 2017-03-02 09:13:34 UTC
gtk3-3.22.9-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-ce763afcbe

Comment 4 Fedora Update System 2017-03-03 04:52:22 UTC
gtk3-3.22.9-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-ce763afcbe

Comment 5 Fedora Update System 2017-03-06 02:51:34 UTC
gtk3-3.22.9-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 6 Dave Johnston 2017-04-24 06:42:13 UTC
This bug has reared its head for me on FC25 w/ gtk3-3.22.11-1.fc25.x86_64 and gnome-terminal-3.22.1-5.fc25.x86_64. The problem disappears entirely when using the X11 fallback.

Comment 7 Dave Johnston 2017-04-24 08:02:06 UTC
A little additional info to help ascertain if it's the same issue: when this occurs, pressing a different key just causes the new key to repeat instead (i.e. `...aaaaaa[press b]b[short delay]bbbbb...`).

The only key I've found that restores normal behaviour is Super/WinKey, which does not repeat when pressed (although this could be because it brings up the task switcher?)

Comment 8 Olivier Fourdan 2017-04-24 08:33:46 UTC
This is weird, do you mean it was fixed and re-appeared after those updates gtk3-3.22.11-1.fc25 and gnome-terminal-3.22.1-5.fc25, or it was never fixed for you, not even with gtk3-3.22.9-2.fc25?

Comment 9 Dave Johnston 2017-04-24 08:51:50 UTC
It first appeared for me towards the end of March after a normal FC25 system update, and has persisted ever since. I initially thought it was a hardware issue, but then found out the issue only occurred when running Wayland. I don't recall encountering it before then.

Subsequent FC25 system updates have not fixed the issue for me.

Comment 10 Olivier Fourdan 2017-04-24 09:25:58 UTC
Just to be sure, could you check that gnome-terminal-server is really using the expected gtk+ lib?

  $ egrep "libgdk-3|libgtk-3"  /proc/$(pidof gnome-terminal-server)/maps

Also, rpm -qf on the resulting files, e.g.,:

  $ rpm -qf /usr/lib64/libgtk-3.so.0.2200.11

Comment 11 Dave Johnston 2017-04-24 17:54:47 UTC
Sure, here's the output:

  $ egrep "libgdk-3|libgtk-3"  /proc/$(pidof gnome-terminal-server)/maps
  7fb9c8453000-7fb9c853e000 r-xp 00000000 fd:01 2237709                    /usr/lib64/libgdk-3.so.0.2200.11
  7fb9c853e000-7fb9c873e000 ---p 000eb000 fd:01 2237709                    /usr/lib64/libgdk-3.so.0.2200.11
  7fb9c873e000-7fb9c8746000 r--p 000eb000 fd:01 2237709                    /usr/lib64/libgdk-3.so.0.2200.11
  7fb9c8746000-7fb9c8748000 rw-p 000f3000 fd:01 2237709                    /usr/lib64/libgdk-3.so.0.2200.11
  7fb9c8748000-7fb9c8e41000 r-xp 00000000 fd:01 2249292                    /usr/lib64/libgtk-3.so.0.2200.11
  7fb9c8e41000-7fb9c9040000 ---p 006f9000 fd:01 2249292                    /usr/lib64/libgtk-3.so.0.2200.11
  7fb9c9040000-7fb9c904f000 r--p 006f8000 fd:01 2249292                    /usr/lib64/libgtk-3.so.0.2200.11
  7fb9c904f000-7fb9c9051000 rw-p 00707000 fd:01 2249292                    /usr/lib64/libgtk-3.so.0.2200.11

  $ rpm -qf /usr/lib64/libgtk-3.so.0.2200.11
  gtk3-3.22.11-1.fc25.x86_64

Comment 12 Olivier Fourdan 2017-04-25 13:59:23 UTC
I'm sorry, I must be missing something... Anything in particular you do when this occurs, anything to trigger the issue?

Comment 13 Dave Johnston 2017-04-25 14:59:16 UTC
I've been unable to identify a common cause - typically I'm either typing a command into in zsh, or coding in vim, and it occurs for no apparent reason. The fact there's a short key repeat delay means it typically starts happening a fair few key presses before it manifests itself, but I'm typing too quickly for the key repeat to occur.

I can't remember precisely if it's ever happened outside of gnome-terminal (in rxvt or Chrome, for example) - I'll try to verify this today. All I know is that it doesn't happen if I run my same Gnome desktop over X11 instead.

Comment 14 Olivier Fourdan 2017-04-25 15:20:02 UTC
Does it ever involve focus changes?

Can you also check if switching focus (even opening a menu in gnome-terminal) makes the issue go away?

Comment 15 Dave Johnston 2017-04-26 12:28:38 UTC
The issue went away as soon as I clicked on a menu in gnome-terminal (using the mouse), so yes - looks like switching focus does stop it. I'll play around with giving gnome-terminal focus to see if I can get better repro steps.

I've so far been unable to reproduce the issue in gedit or other apps, but I'm going to keep trying.

Comment 16 Olivier Fourdan 2017-04-26 15:40:46 UTC
There's one thing we could try...

I've prepared a scratch build (https://koji.fedoraproject.org/koji/taskinfo?taskID=19217266) of the most recent gtk3 package for f25 (current is gtk3-3.22.12-2.fc25 from update-testing) and added some more verbosity to the debug logs (scratch builds get automatically removed, make sure to download the packages soon enough)

You could try running these, capture the event logs, and possibly reproduce the issue. That could tell why gtk3 reckons a key (or more) is kept depressed while it's presumably not the case (and which key as well).

1. Get the rpm packages for x86_64 here:
   https://kojipkgs.fedoraproject.org//work/tasks/7268/19217268/

2. Update your packages with these (rpm -Fvh ...)

3. Run gnome-terminal-server with GDK_DEBUG=events and WAYLAND_DEBUG=1 set and capture the events log:

   $ GDK_DEBUG=events WAYLAND_DEBUG=1 /usr/libexec/gnome-terminal-server --app-id my.foo.Terminal 2&> events.log & sleep 1; gnome-terminal --app-id my.foo.Terminal

   (Note, this is with bash, the syntax may differ with zsh, dunno...)

4. Reproduce, if possible and send/attach the events.log file produced by gnome-terminal-server with GDK_DEBUG=events

*BEWARE* that will log every event, including *every* key press/release typed in the terminal window, make sure to *avoid typing any sensitive data* while logging the events!

Comment 17 Dave Johnston 2017-04-28 06:24 UTC
Created attachment 1274815 [details]
events.log generated from gnome-terminal-server

Thanks Olivier, attached is a log. The issue occurred approximately 10 seconds before the end of the log, during which I was getting repeated keypresses from my arrow keys. I then used the mouse to click on a menu item to stop it - which it did - and then terminated gnome-terminal.

Comment 18 Olivier Fourdan 2017-04-28 07:02:29 UTC
Thanks!

Comment 19 Olivier Fourdan 2017-04-28 08:07:20 UTC
One more thing, can you confirm this was captured as per the procedure in comment 16 and you are using gnome-shell as the wayland compositor? I mean, this is GNOME on Wayland, right?

Comment 20 Dave Johnston 2017-04-28 08:17:10 UTC
Yup, I followed your steps while using GNOME on Wayland. I can repeat the steps and get another log if required?

Could also try reproducing the issue on a fresh FC25 install to help isolate it.

Comment 21 Olivier Fourdan 2017-04-28 09:15:30 UTC
No, no need, that's fine, I still have a lot of work to make sense of the one you already provided :) Reason I asked is because is seems many entries in the file get logged twice, especially with key events, I am not sure why...

What I see there is, a key is pressed (keycode 114 = Right)

 | [ 31727.507] wl_keyboard@26.key(77537[ 31727.507] wl_keyboard@26.key(77537, 44618361, 106, 1), 44618361, 106, 1)  <== (note the duplicate event)
 | Gdk-Message: keyboard press event, code 114, sym 65363, string , mods 0x0, with 0 key pressed <== (there is an offset of 8, so 106 == code 114)

then the key is kept depressed and repeat starts

 | Gdk-Message: keyboard press event (repeat), code 114, sym 65363, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 114, sym 65363, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 114, sym 65363, string , mods 0x0, with 1 key pressed
...

then another key press reported by the compositor (keycode 115 = End):

 | [ 32372.412] wl_keyboard@26.key(77538, 44619001, 107[ 32372.412] wl_keyboard@26.key(77538, 44619001, 107, 1), 1)

(again the duplicate/mixed log entry, dunno why)

 | Gdk-Message: keyboard press event, code 115, sym 65367, string , mods 0x0, with 1 key pressed

(The "1 key pressed" here is normal, the number of keys pressed is incremented after the log message in the code)

then the first key (keycode 114 = Right) is released :

 | [ 32531.750] wl_keyboard@26.key(77539[ 32531.750] wl_keyboard@26.key(77539, 44619165, 106, 0), 44619165, 106, 0)
 | Gdk-Message: keyboard release event, code 114, sym 65363, string , mods 0x0, with 2 keys pressed

(again, the "2 key pressed" here is normal, the number of keys pressed is decremented after the log message in the code)

the key (keycode 115 = End) is repeated:

 | Gdk-Message: keyboard press event (repeat), code 115, sym 65367, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 115, sym 65367, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 115, sym 65367, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 115, sym 65367, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 115, sym 65367, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 115, sym 65367, string , mods 0x0, with 1 key pressed
 | Gdk-Message: keyboard press event (repeat), code 115, sym 65367, string , mods 0x0, with 1 key pressed

and another key is pressed (keycode 113 = Left):

 | [ 33183.485] wl_keyboard@26.key(77540, 44619817, 105, 1)
 | Gdk-Message: keyboard press event, code 113, sym 65361, string , mods 0x0, with 1 key pressed

then released (keycode 113 = Left):

 | [ 33321.831] wl_keyboard@26.key(77541[ 33321.831] wl_keyboard@26.key(77541, 44619955, 105, 0), 44619955, 105, 0)
 | Gdk-Message: keyboard release event, code 113, sym 65361, string , mods 0x0, with 2 keys pressed

and repeated:

 | Gdk-Message: keyboard press event (repeat), code 113, sym 65361, string , mods 0x0, with 1 key pressed

=> So we never got the key release from the compositor for the "End" key and whatever other key pressed gets repeated. 

I can indeed reproduce the same behavior by keeping the "End" key pressed but it end when I release the "End" key. Of course, I take it your "End" is not kept pressed, at least not purposely... :)

So I have a couple of additional questions:

 - Are you sure your keyboard is not faulty, especially the "End" key?
 - If so, do you have any special shortcut action set on the "End" key?

Comment 22 Olivier Fourdan 2017-04-28 09:34:02 UTC
(also, I just checked quickly, Xorg behaves differently if a key is kept depressed, it won't repeat after another key is pressed/released, so if this is a hardware issue as I suspect, it won't show in Xorg as you mentioned)

Comment 23 Dave Johnston 2017-04-28 09:48:31 UTC
Interesting, I'm not aware of the End key being faulty, but given the Xorg behaviour you describe I'll have a look into it. (Thanks and apologies in advance if you're correct!)

Comment 24 Olivier Fourdan 2017-04-28 09:59:07 UTC
I think I can make gtk3 on Wayland handle such a case better though... I'll file a bug upstream and work from there.

Comment 25 Olivier Fourdan 2017-04-28 13:56:41 UTC
I have filed upstream bug https://bugzilla.gnome.org/show_bug.cgi?id=781896 with a possible fix (I hope) to work around a key being kept pressed.

Note, the patch upstream is not reviewed nor approved yet.

Meanwhile, I have launched a new scratch build of gtk3 with that patch added here:

  https://koji.fedoraproject.org/koji/taskinfo?taskID=19272390

(as usual, scratch builds for testing purpose, those are not meant to last, grab it while it's there...)

x86_64 packages here:

  https://kojipkgs.fedoraproject.org//work/tasks/2393/19272393/

You may want to try those and see if they work for you. Please make sure to restart gnome-terminal-server after upgrading otherwise the old lib will remain in effect if the terminal server daemon remains running.

Comment 26 Dave Johnston 2017-04-28 19:44:13 UTC
I've just had a play around and can now reproduce the issue with 100% reliability, however it doesn't appear to be a hardware issue from my understanding.

First, some background - I have a Dell XPS 13 (L322X model) which has a compact keyboard. The Home/End/PgUp/PgDown are activated by holding Fn while tapping Left/Right/Up/Down.

The issue occurs with 100% reliability if I release Fn before release the respective arrow key. That is:
1. Press and hold Fn
2. Press and hold Up [PgUp] (or any other arrow key)
3. Release Fn
4. Release Up

This causes the behaviour. I can rectify by reversing steps 3 and 4 (i.e. release Fn last)

Comment 27 Dave Johnston 2017-04-28 19:46:40 UTC
Oh, additionally this only occurs apps running on Wayland (gnome-terminal, gedit etc.) - I can not reproduce the same issue in Xorg apps such as rxvt or Chrome running within the same Wayland session.

Comment 28 Dave Johnston 2017-04-28 19:50:14 UTC
I can confirm the issue is rectified in all known affected apps with the test build posted. Thanks, Olivier!


Note You need to log in before you can comment on or make changes to this bug.