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

100% cpu core on starting daemon #397

Closed
ViridiFox opened this issue Nov 28, 2022 · 7 comments
Closed

100% cpu core on starting daemon #397

ViridiFox opened this issue Nov 28, 2022 · 7 comments

Comments

@ViridiFox
Copy link

ViridiFox commented Nov 28, 2022

When updating I found that keyd stopped working and was using max cpu in a thread.
Going back to v2.4.0 fixes the issue.

sudo journalctl -eu keyd

Nov 28 11:01:33 fedora systemd[1]: Stopped keyd.service - key remapping daemon.
Nov 28 11:01:33 fedora systemd[1]: Started keyd.service - key remapping daemon.
Nov 28 11:01:33 fedora keyd[5668]: Starting keyd v2.4.2 (aa4c5cf)
Nov 28 11:01:33 fedora keyd[5668]: socket: /var/run/keyd.socket
Nov 28 11:01:33 fedora keyd[5668]: device added: 1e7d:311a ROCCAT ROCCAT Vulcan Pro TKL (/dev/input/event9)
Nov 28 11:01:33 fedora keyd[5668]:         matched /etc/keyd/default.conf
Nov 28 11:02:28 fedora systemd[1]: Stopping keyd.service - key remapping daemon...
Nov 28 11:02:28 fedora systemd[1]: keyd.service: Main process exited, code=exited, status=15/n/a
Nov 28 11:02:28 fedora systemd[1]: keyd.service: Failed with result 'exit-code'.
Nov 28 11:02:28 fedora systemd[1]: Stopped keyd.service - key remapping daemon.
Nov 28 11:02:28 fedora systemd[1]: keyd.service: Consumed 55.150s CPU time.
Nov 28 11:02:28 fedora systemd[1]: Started keyd.service - key remapping daemon.
Nov 28 11:02:28 fedora keyd[6036]: Starting keyd v2.4.1 (4084a9d)
Nov 28 11:02:28 fedora keyd[6036]: socket: /var/run/keyd.socket
Nov 28 11:02:28 fedora keyd[6036]: device added: 1e7d:311a ROCCAT ROCCAT Vulcan Pro TKL (/dev/input/event9)
Nov 28 11:02:28 fedora keyd[6036]:         matched /etc/keyd/default.conf
Nov 28 11:03:22 fedora systemd[1]: Stopping keyd.service - key remapping daemon...
Nov 28 11:03:22 fedora systemd[1]: keyd.service: Main process exited, code=exited, status=15/n/a
Nov 28 11:03:22 fedora systemd[1]: keyd.service: Failed with result 'exit-code'.
Nov 28 11:03:22 fedora systemd[1]: Stopped keyd.service - key remapping daemon.
Nov 28 11:03:22 fedora systemd[1]: keyd.service: Consumed 53.689s CPU time.
Nov 28 11:03:22 fedora systemd[1]: Started keyd.service - key remapping daemon.
Nov 28 11:03:22 fedora keyd[6380]: Starting keyd v2.4.0 (90c3687)
Nov 28 11:03:22 fedora keyd[6380]: socket: /var/run/keyd.socket
Nov 28 11:03:22 fedora keyd[6380]: device added: 1e7d:311a ROCCAT ROCCAT Vulcan Pro TKL (/dev/input/event9)
Nov 28 11:03:22 fedora keyd[6380]:         matched /etc/keyd/default.conf
Nov 28 11:03:22 fedora keyd[6380]: device added: 046d:c332 Logitech Gaming Mouse G502 Keyboard (/dev/input/event6)
Nov 28 11:03:22 fedora keyd[6380]:         matched /etc/keyd/default.conf
Nov 28 11:03:22 fedora keyd[6380]: device added: 1532:021e Razer Razer Ornata Chroma Keyboard (/dev/input/event4)
Nov 28 11:03:22 fedora keyd[6380]:         matched /etc/keyd/default.conf
Nov 28 11:03:22 fedora keyd[6380]: device added: 1532:021e Razer Razer Ornata Chroma (/dev/input/event2)
Nov 28 11:03:22 fedora keyd[6380]:         matched /etc/keyd/default.conf

Config doesn't seem to matter. Tried multiple including the examples in the readme.

@rvaiya
Copy link
Owner

rvaiya commented Nov 28, 2022

Does this happen using the latest commit? (35bd18f)

@ViridiFox
Copy link
Author

Yes it still happens.

Nov 29 13:04:05 fedora systemd[1]: Started keyd.service - key remapping daemon.
Nov 29 13:04:05 fedora keyd[6199]: CONFIG: parsing /etc/keyd/default.conf
Nov 29 13:04:05 fedora keyd[6199]: Starting keyd v2.4.2 (35bd18f)
Nov 29 13:04:05 fedora keyd[6199]: DEVICE: ignoring 0fac:1ade  (keyd virtual pointer)
Nov 29 13:04:05 fedora keyd[6199]: DEVICE: ignoring 056a:0374  (Wacom Intuos S Pad)
Nov 29 13:04:05 fedora keyd[6199]: DEVICE: ignoring 056a:0374  (Wacom Intuos S Pen)
Nov 29 13:04:05 fedora keyd[6199]: DEVICE: match    1e7d:311a  /etc/keyd/default.conf        (ROCCAT ROCCAT Vulcan Pro TKL)
Nov 29 13:04:05 fedora keyd[6199]: DEVICE: ignoring 1e7d:311a  (ROCCAT ROCCAT Vulcan Pro TKL Consumer Control)
Nov 29 13:04:05 fedora keyd[6199]: DEVICE: ignoring 1e7d:311a  (ROCCAT ROCCAT Vulcan Pro TKL Mouse)
Nov 29 13:05:15 fedora systemd[1]: Stopping keyd.service - key remapping daemon...
Nov 29 13:05:15 fedora systemd[1]: keyd.service: Main process exited, code=exited, status=15/n/a
Nov 29 13:05:15 fedora systemd[1]: keyd.service: Failed with result 'exit-code'.
Nov 29 13:05:15 fedora systemd[1]: Stopped keyd.service - key remapping daemon.
Nov 29 13:05:15 fedora systemd[1]: keyd.service: Consumed 1min 9.166s CPU time.
Nov 29 13:05:15 fedora systemd[1]: Started keyd.service - key remapping daemon.
Nov 29 13:05:15 fedora keyd[6633]: CONFIG: parsing /etc/keyd/default.conf
Nov 29 13:05:15 fedora keyd[6633]: Starting keyd v2.4.2 (bcfb8bb)
Nov 29 13:05:15 fedora keyd[6633]: DEVICE: ignoring 0fac:1ade  (keyd virtual pointer)
Nov 29 13:05:15 fedora keyd[6633]: DEVICE: ignoring 056a:0374  (Wacom Intuos S Pad)
Nov 29 13:05:15 fedora keyd[6633]: DEVICE: ignoring 056a:0374  (Wacom Intuos S Pen)
Nov 29 13:05:15 fedora keyd[6633]: DEVICE: match    1e7d:311a  /etc/keyd/default.conf        (ROCCAT ROCCAT Vulcan Pro TKL)
Nov 29 13:05:15 fedora keyd[6633]: DEVICE: ignoring 1e7d:311a  (ROCCAT ROCCAT Vulcan Pro TKL Consumer Control)
Nov 29 13:05:15 fedora keyd[6633]: DEVICE: ignoring 1e7d:311a  (ROCCAT ROCCAT Vulcan Pro TKL Mouse)
Nov 29 13:06:35 fedora systemd[1]: Stopping keyd.service - key remapping daemon...
Nov 29 13:06:35 fedora systemd[1]: keyd.service: Main process exited, code=exited, status=15/n/a
Nov 29 13:06:35 fedora systemd[1]: keyd.service: Failed with result 'exit-code'.
Nov 29 13:06:35 fedora systemd[1]: Stopped keyd.service - key remapping daemon.
Nov 29 13:06:35 fedora systemd[1]: keyd.service: Consumed 1min 19.475s CPU time.

@rvaiya
Copy link
Owner

rvaiya commented Nov 29, 2022

Thanks. Can you post the output when running with $KEYD_DEBUG=1 as well as the details of your distro and hardware setup? Does this also happen when you manually try and start the daemon (sudo systemctl stop keyd;sudo keyd)?

@ViridiFox
Copy link
Author

ViridiFox commented Nov 30, 2022

distro: Fedora Linux 37 (Workstation Edition) x86_64
kernel: 6.0.9-300.fc37.x86_64
cpu: AMD Ryzen 9 5900X (24) @ 3.700GHz
gpu: AMD ATI Radeon RX 6950 XT

no change when running it manually:

nu ❯ KEYD_DEBUG=1 sudo keyd
CONFIG: parsing /etc/keyd/default.conf
Starting keyd v2.4.2 (bcfb8bb)
DEVICE: ignoring 0fac:1ade  (keyd virtual pointer)
DEVICE: ignoring 056a:0374  (Wacom Intuos S Pad)
DEVICE: ignoring 056a:0374  (Wacom Intuos S Pen)
DEVICE: match    1e7d:311a  /etc/keyd/default.conf      (ROCCAT ROCCAT Vulcan Pro TKL)
DEVICE: ignoring 1e7d:311a  (ROCCAT ROCCAT Vulcan Pro TKL Consumer Control)
DEVICE: ignoring 1e7d:311a  (ROCCAT ROCCAT Vulcan Pro TKL Mouse)
^C

~/repos/keyd [⏱ 15s ]
nu ❯

keyd's status:
image

@ivan-volnov
Copy link

@rvaiya I have the same issue and no mappings are working.
FreeBSD 13.1-RELEASE

@jbeich
Copy link
Contributor

jbeich commented Apr 2, 2023

According to git bisect on FreeBSD it was regressed by 0c91ed8 (confirmed via af363a2).

@rvaiya rvaiya closed this as completed in f09342b Apr 4, 2023
rvaiya added a commit that referenced this issue Apr 4, 2023
It turns out the linux uinput driver is capable of
automatically generating repeat events if you
flip the right kernel bit, so we can eliminate
the kludgy thread based repeat logic.

This should also fix #397, since said code was relying
on undefined pthread behaviour that caused some systems
to busy wait.
@rvaiya
Copy link
Owner

rvaiya commented Apr 4, 2023

I believe this should be fixed in the latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants