Bug 486535

Summary: kwin_wayland starts consuming a high amount of CPU
Product: [Plasma] kwin Reporter: Luca Carlon <carlon.luca>
Component: performanceAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, kelvie, lmusizza+kde, mohamedzhran100, nate, salvatore.cresce
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Luca Carlon 2024-05-04 01:46:53 UTC
SUMMARY
After a variable amount of time, kwin_wayland starts consuming a high amount of CPU. Typical CPU usage of kwin_wayland while system is idle is 0-2% on this machine. When the problem appears, consumption rises to 8-12% or even more. Framerate is lower and CPU fan accelerates.
This only started to happen when I upgraded to Plasma 6. It never happened with Plasma 5.

STEPS TO REPRODUCE
After trying many things, I found a weird way to reproduce. It does not happen 100% of the times, but doesn't take much to reproduce here:

1. Close every application/window.
2. Open VLC and play a video (in Manjaro VLC 3 is using XWayland by default);
3. Seek a few times into the video or/and try to resize the window a bit. This makes kwin_wayland consume a bit more CPU, going above 20%, which may be normal;
4. wait a few seconds and close VNC.
5. In some cases, kwin_wayland goes back to 1% or less, which is OK. Go back to step 2 in this case and try again. In other cases, it remains at around 10% CPU or even more.

OBSERVED RESULT
System framerate lowers. It even affects video playback in VLC, making the system pretty bad to use. Fan accelerates, leading to higher battery consumption. The situation does not fix by itself, I need to reboot or logout/login.

EXPECTED RESULT
With the provided steps, I'd expect kwin_wayland to go back to the usual 0-2% CPU usage after VLC is closed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.8.8-2-MANJARO (64-bit)
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0

ADDITIONAL INFO:
I tried to disable vaapi acceleration. Nothing changes. I tried to blacklist nvidia (I only use the Intel GPU anyway), nothing changed.
Comment 1 Luca Carlon 2024-05-24 21:14:34 UTC
I can reproduce with other apps using XWayland.
Comment 2 David Edmundson 2024-06-04 10:11:03 UTC

*** This bug has been marked as a duplicate of bug 485425 ***
Comment 3 mohamed_zhran 2024-06-13 17:13:04 UTC
i solved this issue by using this command 
kwin_wayland --replace
and I found that an app I was using caused this issue called "timedoctor" but I had to remove it from autostart