#470886 xserver-xorg-input-kbd: repeated KeyPress events when switching VT while pressing a key

Package:
xserver-xorg-input-kbd
Source:
xserver-xorg-input-keyboard
Description:
X.Org X server -- keyboard input driver
Submitter:
Stephane Chazelas
Date:
2026-02-11 18:35:02 UTC
Severity:
normal
#470886#5
Date:
2008-03-14 10:37:58 UTC
From:
To:
Hiya,

this has been buggering me for a long time, only now I've put a
little investigation in it.

If, from xorg, I switch to another VT while pressing a key, the
original X server keeps sending keypress events to the
previously focused client (and keyrelease events to some other
client which I've not determined) at the keyboard repeat rate.

This is typically reproduced with "kdmctl reserve".

When using KDM as the display manager, the "kdmctl reserve"
starts a new logging banner on a new X server on a new VT.

So, if, in an xterm, one enters at the shell prompt:

kdmctl reservee<Return>

There's a switch of VT after the <Return> key has been pressed
and before it has been released. If you get back to the original
VT (<Ctrl+Alt+F7>), you'll notice that the xterm has output a
lot of shell prompts as if the <Return> key had been left
pressed the whole time.

Doing a strace(1) on xterm and on the X server shows that the X
server sends a lot of KeyPress events with keycode 36 (Return)
to the xterm (and it seems to send KeyRelease events to another
client)

strace on the X server:
writev(17, [{"\3$|W\257\352h\0I\0\0\0\n\0 \2\16\0 \2\214\0027\1\210\2"..., 32}], 1) = 32
writev(25, [{"\2$\214Y\257\352h\0I\0\0\0\16\0 \2\0\0\0\0\214\0027\1\210"..., 32}], 1) = 32

(\3 is KeyRelease, \2 is KeyPress, $ (0x24) is <Return>'s
keycode, 25 is the fd to the unix socket to the xtern, 17 I
don't know)

If I press <Ctrl-J> instead of <Return> to accept the "kdmctl
reserve" command line, I see the <Ctrl-J> event being repeated.

Though I have no idea about the code, I suspect that a check
should be added to the code that generates keyboard repeat
events that the current VT is the X server's VT. Or that upon
switching to a different VT, all keys should be released. What
do you think?

#470886#10
Date:
2008-03-16 15:21:50 UTC
From:
To:
Stephane Chazelas wrote:

Still the same with xserver-xorg-core 2:1.4.1~git20080131-2 ?

Brice

#470886#15
Date:
2008-06-04 18:23:13 UTC
From:
To:
On Sun, Mar 16, 2008 at 04:21:50PM +0100, Brice Goglin wrote:
[...]
[...]

Désolé Brice,

I had missed your email at the time. Yes, it is the same with
2:1.4.1~git20080131-3 and 2:1.4.1~git20080517-1 and it's
consistently reproductible on all the debian machines I have
access to.

regards,
Stéphane

#470886#20
Date:
2009-12-10 21:15:43 UTC
From:
To:
This bug occurred here with this combination:

xserver-xorg 1:7.4+4
xserver-xorg-core 2:1.6.5-1
xserver-xorg-input-evdev 1:2.2.5-1
xserver-xorg-input-kbd not installed

Even though this bug has been filed on xserver-xorg-input-kbd,
which I don't have installed, the symptoms match.
It typically happens when I switch from X to tty1 with
Ctrl+Alt+F1 and keep the F1 key pressed a bit too long.
The X server then keeps sending events about the key.
In powertop, this appears to cause almost 30 wakeups per second
and increase the power consumption by about 2 watts.

#470886#25
Date:
2026-02-11 18:32:28 UTC
From:
To:
Reassigning to xserver-xorg-core, which is where these happen.

Samuel

Kalle Olavi Niemitalo, le jeu. 10 déc. 2009 23:15:43 +0200, a ecrit: