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

[Mir-on-X] Keys repeated #1471

Open
wmww opened this issue May 11, 2020 · 9 comments
Open

[Mir-on-X] Keys repeated #1471

wmww opened this issue May 11, 2020 · 9 comments
Labels
triaged Triage into JIRA to plan it in

Comments

@wmww
Copy link
Contributor

wmww commented May 11, 2020

After a number of XWayland windows are open, quickly typed keys sometimes come out repeated a bunch of times. It only seems to happen when a bunch of XWayland windows are open, but both XWayland and Wayland windows are effected. I suspect this is due to a combination of causes:

  • Either an XWayland thread or the Wayland thread is bogged down (it shouldn't take that long to get events out the door)
  • Proper timestamps not being used (I haven't looked into this, but if we're keeping timestamps attached to the events it shouldn't matter if there's a delay going out)
  • Short time before keys start repeated (Not the real issue, but our hard-coded value is quite short)

EDIT: so far I've only observed this in Mir-on-X.

@wmww wmww added the XWayland label May 11, 2020
@AlanGriffiths
Copy link
Collaborator

I'm suspicious of the thread safety around the Mir-on-X platform. (But might find everything significant runs on a single thread when I take a closer look.)

@AlanGriffiths
Copy link
Collaborator

  • Short time before keys start repeated (Not the real issue, but our hard-coded value is quite short)

I don't think Wayland (including via Xwayland) clients make any use of Mir's server-side auto-repeat, so this shouldn't be affecting anything.

@AlanGriffiths AlanGriffiths added the Needs Info Waiting on further information before the bug can be resolved label Aug 4, 2020
@AlanGriffiths
Copy link
Collaborator

This sounds a lot as though it might have been fixed by #1623 (or, possibly, #1646).

I've not seen it often, @wmww have you seen it recently?

@wmww
Copy link
Contributor Author

wmww commented Aug 4, 2020

I've just confirmed it's still a problem.

@AlanGriffiths
Copy link
Collaborator

This seems entirely down to the Mir-on-X platform.

The easiest way to reproduce is to use a Mir server over ssh -x to another machine on the local network. There's no need to enable X11 support on the Mir server.

I'm not sure exactly what triggers it yet, but in this scenario it happens a lot.

@wmww
Copy link
Contributor Author

wmww commented Apr 12, 2021

It seems like something is slowing down the thread that handles X11 input. In some cases, this can be slowed down by as much as dozens or hundreds of milliseconds, which then causes a key to appear down long enough to trigger a repeat. I'm tracking down where this is happening.

@wmww
Copy link
Contributor Author

wmww commented Apr 12, 2021

Hmm, I've now put X11 events on their own dispatcher and that doesn't seem to help. Maybe XLib is doing something synchronously that is blocking events?

@AlanGriffiths
Copy link
Collaborator

OK, I've dug into this on both the existing xlib and proposed xcb based X platforms.

The key repeats happen because the client doesn't see the release event until long after the press event. But that's because the same is true of the X11 input platform. From my debug session:

[2021-04-23 15:58:43.483781] < - debug - > x11-input: ====> XInputDevice::key_press(71003340000000, o, ...)
[2021-04-23 15:58:48.662458] < - debug - > x11-input: ==> XInputDevice::key_release(71003444000000, o, ...) // 104ms since press

These event timestamps are 104ms apart, but the times the events are processed are 5s apart.

We could disable the repeats on the client (that ought to be configurable on wl_keyboard anyway). We might also pass through the repeats from the server.

Alternately we could figure out why the connection is so laggy. I also noticed that the screen repaint is very laggy - typing not shown for over 5 seconds (when I moved the mouse).

@AlanGriffiths AlanGriffiths removed Needs Info Waiting on further information before the bug can be resolved XWayland labels Apr 23, 2021
bors bot added a commit that referenced this issue Apr 23, 2021
2010: Respect `--enable-key-repeat` with Wayland r=wmww a=AlanGriffiths

Uses the existing configuration option to configure clients to disable key repeat.

Mitigates: #1471

Co-authored-by: Alan Griffiths <[email protected]>
@AlanGriffiths AlanGriffiths changed the title Keys repeated [Mir-on-X] Keys repeated Sep 28, 2022
@AlanGriffiths
Copy link
Collaborator

Still an issue, most noticeable with a remote X11 session. (e.g. ssh -XC another-machine miriway)

@mattkae mattkae added the triaged Triage into JIRA to plan it in label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Triage into JIRA to plan it in
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants