Xpra: Ticket #13: modifiers key get stuck (alt key generally)



Thu, 18 Aug 2011 16:25:50 GMT - Antoine Martin:

To those who are experiencing this, can you please post details:

Thanks


Sun, 21 Aug 2011 16:03:32 GMT - Timo Juhani Lindfors:

Steps to reproduce: 1) xpra start --no-daemon --start-child gnome-terminal --exit-with-children :9 -d all > xpra.server.txt 2>&1 2) xpra -d all attach :9 > xpra.client.txt 2>&1 3) wait for gnome-terminal to appear, move mouse over it 4) type a, b, c, d, e, f 5) hit alt-tab to switch to some other window 6) hit alt-tab again to switch back to gnome-terminal 7) type f

Expected results: 4) & 7) gnome-terminal reads "abcdeff"

Actual results: 4 & 7) gnome-terminal reads "abcdef" and the File menu is open (since alt+F opens it)

More info: 1) xpra.server.txt and xpra.client.txt are attached.


Sun, 21 Aug 2011 16:03:49 GMT - Timo Juhani Lindfors: attachment set


Sun, 21 Aug 2011 16:03:58 GMT - Timo Juhani Lindfors: attachment set


Sun, 21 Aug 2011 16:06:50 GMT - Timo Juhani Lindfors:

Oh and yes, I'm using gnome.

Also, keys getting stuck cause a lot of weird effects. For example starting xpra can take minutes. Apparently this is because of xmodmap:

$ xpra start --no-daemon --use-display :7
found /home/lindi/xpra-install/amd64/v0.0.7.22-60-ga4aabe0/
Xlib:  extension "RANDR" missing on display ":7.0".
Xlib:  extension "RANDR" missing on display ":7.0".
Xlib:  extension "RANDR" missing on display ":7.0".
Missing window or missing property or wrong property type WM_TRANSIENT_FOR (window)
Missing window or missing property or wrong property type _NET_WM_STRUT_PARTIAL (strut-partial)
Missing window or missing property or wrong property type _NET_WM_STRUT (strut)
Missing window or missing property or wrong property type _NET_WM_STRUT_PARTIAL (strut-partial)
Missing window or missing property or wrong property type _NET_WM_STRUT (strut)
xmodmap:  please release the following keys within 2 seconds:
    Control_L (keysym 0xffe3, keycode 37)
    d (keysym 0x64, keycode 40)
    KP_Up (keysym 0xff97, keycode 80)
xmodmap:  please release the following keys within 4 seconds:
    Control_L (keysym 0xffe3, keycode 37)
    d (keysym 0x64, keycode 40)
    KP_Up (keysym 0xff97, keycode 80)
xmodmap:  please release the following keys within 8 seconds:
    Control_L (keysym 0xffe3, keycode 37)
    d (keysym 0x64, keycode 40)
    KP_Up (keysym 0xff97, keycode 80)
xmodmap:  please release the following keys within 16 seconds:
    Control_L (keysym 0xffe3, keycode 37)
    d (keysym 0x64, keycode 40)
    KP_Up (keysym 0xff97, keycode 80)
xmodmap:  please release the following keys within 32 seconds:
    Control_L (keysym 0xffe3, keycode 37)
    d (keysym 0x64, keycode 40)
    KP_Up (keysym 0xff97, keycode 80)
xmodmap:  unable to set modifier mapping, keyboard problem
Randr not supported: X server does not support required extension Randr
randr enabled: False
xpra is ready.

Wed, 24 Aug 2011 21:11:48 GMT - Timo Juhani Lindfors:

$ grep key-action xpra.client.txt
writing ['key-action', 1, 'a', True, [], 97, 'a', 38]
writing ['key-action', 1, 'a', False, [], 97, 'a', 38]
writing ['key-action', 1, 'b', True, [], 98, 'b', 56]
writing ['key-action', 1, 'b', False, [], 98, 'b', 56]
writing ['key-action', 1, 'c', True, [], 99, 'c', 54]
writing ['key-action', 1, 'c', False, [], 99, 'c', 54]
writing ['key-action', 1, 'd', True, [], 100, 'd', 40]
writing ['key-action', 1, 'd', False, [], 100, 'd', 40]
writing ['key-action', 1, 'e', True, [], 101, 'e', 26]
writing ['key-action', 1, 'e', False, [], 101, 'e', 26]
writing ['key-action', 1, 'f', True, [], 102, 'f', 41]
writing ['key-action', 1, 'f', False, [], 102, 'f', 41]
writing ['key-action', 1, 'Alt_L', True, [], 65513, '', 64]
writing ['key-action', 1, 'Tab', False, [], 65289, '', 23]
writing ['key-action', 1, 'f', True, [], 102, 'f', 41]
writing ['key-action', 1, 'f', False, [], 102, 'f', 41]

shows pretty clearly that the problem is client-side. Client never tells the server that I have released Alt.


Wed, 24 Aug 2011 22:31:51 GMT - Timo Juhani Lindfors: attachment set

proof-of-concept to fix the bug


Wed, 24 Aug 2011 22:32:47 GMT - Timo Juhani Lindfors:

Since this bug really interferes with my ability to use the computer here's a proof-of-concept that works for me(tm) but definitely needs futher polishing.


Wed, 24 Aug 2011 22:56:37 GMT - Timo Juhani Lindfors:

Seems this is still not sufficient. At least quassel opens the menu if I press alt, release alt and then hit f. So, sending release event for alt is not enough.


Wed, 24 Aug 2011 23:01:13 GMT - Timo Juhani Lindfors: attachment set

another prototype to fix the problem


Wed, 24 Aug 2011 23:01:43 GMT - Timo Juhani Lindfors:

It seems that if I send the release events when the window receives focus again then applications correctly handle this.


Thu, 25 Aug 2011 01:42:30 GMT - Antoine Martin: status changed

The problem is not solved client-side at the moment (and I'm not sure it should be either). The code you are looking for is _make_keymask_match in server.py It fires whenever we get keypresses and is meant to ensure the modifiers set on the server match the ones set in the client. Not sure why it stopped working since the keymap changes but now that I have your keymap details I should be able to reproduce.


Thu, 25 Aug 2011 08:07:32 GMT - Timo Juhani Lindfors:

Also non-modifiers get stuck so I don't see how that code would help alone?


Thu, 25 Aug 2011 14:10:29 GMT - Antoine Martin:

In fact, the _make_keymask_match must be server-side, as the client has no way of knowing what state the session is in at the moment, so this is the best place to do it.

Can you give me steps for getting non-modifier keys to get stuck? Do you get that often?


Thu, 25 Aug 2011 14:36:52 GMT - Antoine Martin:

We now apply the full keymap, using 'xmodmap -pke' to grab all the raw keyval mappings from the client (if available) - done in r137

We now also clear all modifiers when a new client attaches to a session (r138), this should fix the xmodmap timeout (which I have not seen myself before).

Now, on to the alt-key gets stuck proper...


Thu, 25 Aug 2011 15:02:21 GMT - Timo Juhani Lindfors:

Yes, I often have one of the arrow keys stuck. You can imagine that this leads to rather bad behavior in different applications :-)


Thu, 25 Aug 2011 15:11:39 GMT - Antoine Martin:

r139 batches the keymap updates and ensures we don't get the same xmodmap timeouts when keymap-changed fires: we also send the client's current modifiers and set them.

I just can't get the alt-tab to get stuck, despite setting my keyboard to as per comment:2


Thu, 25 Aug 2011 15:34:32 GMT - Timo Juhani Lindfors:

Here's how the Up arrow gets stuck with r135:

$ xpra start --no-daemon --start-child gnome-terminal --exit-with-children :9 -d all > xpra.server.txt 2>&1
$ xpra -d all attach :9 > xpra.client.txt 2>&1
# hold the up arrow down
#  notice how the shell is going through all your history entries
# hit alt-tab
# hit alt-tab again
$ grep -E "(key-action|focus)" xpra.client.txt
writing ['focus', 1]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Up', True, [], 65362, '', 111]
writing ['key-action', 1, 'Alt_L', True, [], 65513, '', 64]
writing ['key-action', 1, 'Up', True, ['meta'], 65362, '', 111]
writing ['key-action', 1, 'Up', True, ['meta'], 65362, '', 111]
writing ['focus', 0]
writing ['focus', 1]
writing ['key-action', 1, 'Alt_L', True, [], 65513, '', 64]
writing ['focus', 0]

The client never tells the server that I released the up arrow!


Thu, 25 Aug 2011 17:38:02 GMT - Antoine Martin:

r142 ensures that we clear the keys that are currently pressed when we lose focus, we also send the list of modifiers when we gain focus so we can set them correctly again if any are set. This should fix the problem with "arrow keys get stuck", but probably not "alt gets stuck"... Please confirm if this is an improvement for you.


Wed, 31 Aug 2011 18:15:29 GMT - Antoine Martin: attachment set

testing the alt-tab issue on Debian Squeeze (screenshot)


Wed, 31 Aug 2011 18:17:17 GMT - Antoine Martin:

I've just tested on r142 on a fresh install of Debian Squeeze, as you can see on the screenshot the keyboard is set to finnish. I've tried and tried again to reproduce the bug and I just can't do it! :(

Do I need to launch another VM with Debian Sid on it?


Wed, 07 Sep 2011 09:33:30 GMT - Antoine Martin:

Another commit related to stuck keys: clear keys when client disconnects and ensure we don't re-set them by ignoring any packets arriving in the new "closing" state.


Wed, 07 Sep 2011 09:53:15 GMT - Antoine Martin:

Finally, this is for the very unusual case where the server is control-Ced from within the client (via screen) and we end up with the control key stuck: r159 always clears the modifiers on startup so users can re-attach to an existing display (with -use-display=) and not have xmodmap timeouts.


Fri, 23 Sep 2011 14:49:40 GMT - Antoine Martin: priority, milestone changed

r187 improves this further Although I have seen the 'C' key getting stuck when I ^C the server from within xpra via screen, this is a unusual scenario and should no longer cause timeouts when re-starting the server. Lowering priority, please raise again if any of this is wrong.


Thu, 08 Dec 2011 13:44:55 GMT - Antoine Martin: status changed; resolution set

Not heard anything for 3 months, closing.


Mon, 20 Feb 2012 20:13:14 GMT - Antoine Martin: milestone changed; version set


Sat, 23 Jan 2021 04:43:12 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/13