Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xwayland: applications at some point receive neverending stream of characters #6095

Open
cherti opened this issue Mar 13, 2021 · 18 comments
Open
Labels
bug Not working as intended

Comments

@cherti
Copy link
Contributor

cherti commented Mar 13, 2021

Description

Sometimes (i.e. it suddenly happens, so far it is completely non-obvious to me how it is triggered) xwayland-clients start to receive an endless stream of keys upon gaining focus, as if a key was continuously pressed all the time.

So far I have observed this with number keys, most prominently I have observed it with 2, but I think I have seen 7 in the past as well.

Steps to reproduce:

  1. Do the so far unknown black magic that triggers the event
  2. let a xwayland-application gain focus
  3. if not included in 2. already, select any text field or prompt
  4. see characters streaming in endlessly

Ways to stop the behavior:

  • press Esc (works until the client looses focus and gains it next time, then everything starts anew)
  • completely restart sway (as in exit and start anew, reloading doesn't do), then the issue is gone for that moment. Only reliable way I have found, restarting the applications in question doesn't do the trick and it happens, if it starts, for all xwayland-applications that are opened or will be opened after the issue starts

Sway Version: 1.5.1

Debug Log:

At time of noticing the issue, the log is filled with the following lines (the frequency of the entries seems to roughly match the frequency with which characters are streaming in):

Mar 13 12:33:21 <hostname> sway[2192]: 09:51:33.691 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:35.755 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:35.755 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.356 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.356 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.395 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.395 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.435 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.435 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.475 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.475 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.515 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:23 <hostname> sway[2192]: 09:51:36.515 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.555 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.555 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.595 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.595 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.635 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.635 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.675 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.675 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.715 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.715 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.755 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.756 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.795 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.795 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.835 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:36.835 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:37.259 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
Mar 13 12:33:24 <hostname> sway[2192]: 09:51:37.259 [sway/input/text_input.c:122] Inactive text input tried to commit an update
Mar 13 12:33:25 <hostname> sway[2192]: 09:51:37.892 [DEBUG] [types/wlr_text_input_v3.c:181] Text input commit received without focus
  • Configuration File:
    As it is very unclear how this is triggered, it only happens rarely and I haven't found a way to manually trigger this, thinning down the configuration proves to be difficult and lengthy. WIP.
@cherti cherti added the bug Not working as intended label Mar 13, 2021
@emersion
Copy link
Member

Can you try sway/wlroots master?

@cherti
Copy link
Contributor Author

cherti commented Mar 13, 2021

yeah, should be able to do that. Primarily for verification or do you have something particular in mind that could be the culprit/fix?

@emersion
Copy link
Member

A couple of text-input fixes have made it to master.

@cherti
Copy link
Contributor Author

cherti commented Mar 13, 2021

Now on:
sway: 1.5-e5913f81
wlroots: 0.12.0.r375.g44fa2c4b-1

As the issue only rarely occurs (from my felt memories less than once a month), reporting back can take some time even if the issue still exists.

@borh
Copy link

borh commented Mar 23, 2021

I believe I have been having the same issue on latest master versions of sway/wlroots (r6647.03daa53a-1/0.12.0.r382.g6230f7be-1 on Arch linux w/hidpi patch) and for a while before that. In my case, the issue pops up relatively quickly after I start using an XWayland app. To be more precise, any key is repeated, pressing ESC will only have the effect of switching the key repeat to be ESC. I believe modifiers are also repeated, and in one case while no key was visibly repeated anywhere the logs were still filling up with:

00:27:44.642 [DEBUG] [sway/input/text_input.c:161] Text input committed update

Sometime, but not always, this is proceeded/succeeded with spamming of the following:

00:30:47.470 [DEBUG] [wlr] [xwayland/xwm.c:1422] unhandled X11 event: MappingNotify (34)

I am not sure where to proceed from here, but I have confirmed that killing XWayland does stop the events and repeating keys on the sway and wlroots side. I could upload the whole debug log, but it's already around 10MBs after a few occurrences of this issue with no obvious relevant events.

@cherti
Copy link
Contributor Author

cherti commented Mar 24, 2021

Might be related but a different one, as for me Esc reliably terminates the problem until the next focus-switch.

@kennylevinsen
Copy link
Member

What version of xwayland are you running?

Could be xwayland not handling e.g. wl_keyboard.enter/leave correctly.

@cherti
Copy link
Contributor Author

cherti commented Mar 24, 2021

What version of xwayland are you running?

21.1.0

@s-mcf
Copy link

s-mcf commented Mar 29, 2021

I updated from sway 1.5/wlroots 0.12.0 to sway/wlroots master today and had this happen to me a couple times very shortly after. In my case, killing fcitx5 stopped the spam. I'm on Arch, no patches, fcitx 5.0.7.

@cherti
Copy link
Contributor Author

cherti commented Mar 30, 2021

Can confirm that sway, r6639.e5913f81 combined with wlroots r375.g44fa2c4b still has the issue.

@kennylevinsen
Copy link
Member

Are you also running fcitx?

@cherti
Copy link
Contributor Author

cherti commented Mar 30, 2021

No, I don't (at least as far as I can tell, i.e. no other package accidentially vendors it).

@cherti
Copy link
Contributor Author

cherti commented Mar 30, 2021

And I can confirm that explicitly killing Xwayland does not resolve the issue, I still need to restart sway.

@cherti
Copy link
Contributor Author

cherti commented Mar 30, 2021

now happened with a different number key again, but so far it's always been number keys. I can, as I have just confirmed, stop said stream also by typing any character, not just backspace, Esc and such.

yuja added a commit to yuja/wlroots that referenced this issue May 7, 2021
According to libinput, release events are generated when device is unplugged,
and libinput copies this behavior for device removal. Let's do the same for
our virtual keyboard.

https://github.com/wayland-project/libinput/commit/8f846a41fa0566fbd72ece676656e20e56ce43e6

This is another attempt to fix swaywm#2034 and the following sway issue:

swaywm/sway#6254

Note that we have other key repeating issues in sway, which aren't addressed
by this patch. Since the virtual keyboard itself isn't destroyed when the
keyboard grab is destroyed, we'll probably need some trick to reset the state
of the corresponding virtual keyboard when the grab is released.

swaywm/sway#6095
swaywm/sway#6193
emersion pushed a commit to swaywm/wlroots that referenced this issue May 7, 2021
According to libinput, release events are generated when device is unplugged,
and libinput copies this behavior for device removal. Let's do the same for
our virtual keyboard.

https://github.com/wayland-project/libinput/commit/8f846a41fa0566fbd72ece676656e20e56ce43e6

This is another attempt to fix #2034 and the following sway issue:

swaywm/sway#6254

Note that we have other key repeating issues in sway, which aren't addressed
by this patch. Since the virtual keyboard itself isn't destroyed when the
keyboard grab is destroyed, we'll probably need some trick to reset the state
of the corresponding virtual keyboard when the grab is released.

swaywm/sway#6095
swaywm/sway#6193
@zarakshR
Copy link

zarakshR commented Jan 17, 2022

I can +1 this issue.

I am getting the same problem on Arch Linux where switching focus to a window causes a stream of "4" to keep being sent to the window. I am on SwayWM version 1.6.1 and xorg-xweyland version 21.1.4-1. I have not yet confirmed if XWayland is related to this.

The issue does not occur on Alacritty. Switching focus to an alacritty window doesnt send a stream of input (although I'm not sure if its because alacritty reads input directly from an stty)

I also can't seem to figure what causes the issue - it starts and stops randomly for me. It doesn't happen very often but when it does there doesn't seem to be any clear reason for it and it usually lasts a few minutes or so before stopping on its own.

@yuja
Copy link

yuja commented Jan 17, 2022

To work around the problem, you can disable the Wayland input method frontend of fcitx5.

  1. fcitx5-config-qt
  2. Addons tab
  3. Check "Show Advanced options"
  4. Uncheck "Wayland Input method frontend"
  5. Restart fcitx5

It will disable input method support on Alacritty, but most of the GUI apps are Gtk/Qt-based,
which work fine without the Wayland IM frontend.

@bard
Copy link

bard commented May 25, 2022

Also seeing this on Arch and sway 1.7. Not running fcitx.

@praschke
Copy link

praschke commented Dec 8, 2023

fcitx5 since 5.0.17 and 5.1.0 has a workaround for this issue, and when it is removed, the problem still occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

9 participants