KarsMulder / evsieve

A utility for mapping events from Linux event devices.
GNU General Public License v2.0
210 stars 12 forks source link

100% CPU usage when using --control-fifo #28

Closed RodrigoQuesadaDev closed 1 year ago

RodrigoQuesadaDev commented 1 year ago

Hi, I know the feature is still half-baked (but for different reasons I understand), but in my computer using the --control-fifo option causes the program to consume 100% of one of my CPU cores for as long as the program is running. The program is otherwise fully functional but this behavior obviously causes some loss of responsiveness in the system.

How to reproduce?

run

evsieve \
        --input /dev/input/by-id/acme-event-kbd \
        --print \
        --output create-link=/dev/input/by-id/test-keyboard1 \
        --control-fifo /tmp/evsieve-control-fifo

then write anything to the FIFO

 echo whatever > /etc/evsieve-control-fifo

CPU usage spikes to 100% and remains there until the program is stopped (although is otherwise fully functional as already mentioned).

Other Info

KarsMulder commented 1 year ago

... ouch, that's a pretty bad bug.

This issue has been fixed on the master branch by commit 8077c408912652a879c7d9b2f87f680ce0dbe1a2. Thank you for the report.

Potentially useful for you to know: I moved the --control-fifo argument to behind a feature gate a little while ago to make clear that its functionality is not considered stable yet for the way-overdue version 1.4 release. When building evsieve from the master branch, you need to use cargo build --release --features control-fifo to include its functionality.

RodrigoQuesadaDev commented 1 year ago

Oh that's amazing, I never expected you to resolve the issue so quickly, thank you so much!

I had some slight idea that it was related to the epoll function you use, and that there was some loop involved, but I certainly lack the knowledge you have to address it myself (so to begin with, I'm not even a Rust developer :laughing: ).

Thank you so much for keeping this project alive, and no worries, I already had figured out how to compile the program with that feature flag enabled. :smile: