Bug 501524

Summary: Excessive bell usage leads to sluggishness
Product: [Plasma] kwin Reporter: Alois Wohlschlager <alois1>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: mc5458060, nate, nicolas.fella
Priority: NOR    
Version First Reported In: 6.3.3   
Target Milestone: ---   
Platform: NixOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alois Wohlschlager 2025-03-15 10:09:00 UTC
SUMMARY
X11 applications (through XWayland) using the bell excessively will cause KWin to become very sluggish to react to user events. In the worst cases this can lead to feedback loops making the session unusable.

STEPS TO REPRODUCE
1. Open some xterms (2 or 3 seems to be enough to reproduce the issue without causing too much instability)
2. Run `while true; do sleep 0.01; echo -e '\a'; done` in each of them

OBSERVED RESULT
The system becomes sluggish to react to user events (keyboard input, cursor movement).

EXPECTED RESULT
The system continues operating normally.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 6.14.0-rc6
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION
* When the bug is triggered, CPU usage is high in kwin_wayland and wireplumber processes, and the degradation becomes more noticeable once wireplumber gets close to a full core of CPU usage. However simply playing back the bell sound in a `pw-play` loop, even using many parallel processes, does not reproduce the bug. This suggests that the issue may actually be KWin blocking on the sound system when the bell is triggered.
* Originally the issue was observed in GeoGebra, which rings the bell when backspace is hit in the empty input field. Holding the backspace key for some seconds will be enough to trigger the issue, seemingly resulting in key repeat becoming stuck, further exacerbating the issue to the extent that the session will be fully unusable.
Comment 1 Nicolas Fella 2025-03-15 18:59:21 UTC
*** Bug 501543 has been marked as a duplicate of this bug. ***
Comment 2 Bug Janitor Service 2025-03-15 19:04:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7350
Comment 3 Nate Graham 2025-03-15 20:15:03 UTC

*** This bug has been marked as a duplicate of bug 500916 ***