Bug 410856

Summary: wayland: kwin uses 100% cpu when idle
Product: [Plasma] kwin Reporter: Miroslav Spehar <mspehar>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: normal CC: joseph, miranda, sthenujan2002
Priority: NOR Keywords: efficiency
Version: 5.16.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: htop showing cpu usage
kubuntu htop showing cpu usage
25% cpu kwin
Screenshot of htop with close to 100% cpu usage
Htop showing the command of the kwin_wayland process taking high cpu usage

Description Miroslav Spehar 2019-08-12 16:51:10 UTC
Created attachment 122090 [details]
htop showing cpu usage

SUMMARY
100% cpu usage when left to be idle in VM. 
when screen is activated, cpu usage drops.


STEPS TO REPRODUCE
1. install basic archlinux desktop with kde plasma
2. login into wayland session
3. disable baloo
4. leave the machine for a while

OBSERVED RESULT
100% cpu usage in kwin

EXPECTED RESULT
minimal cpu usage for kwin


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: latest
KDE Plasma Version: 5.16.4
KDE Frameworks Version: 5.60
Qt Version: 5.13

ADDITIONAL INFORMATION
journal | grep kwin

Aug 03 18:03:17 vm-arch kernel: kwin_wayland[450]: segfault at 128 ip 00007f645d812e9c sp 00007ffd89473ee0 error 4 in libkwin.so.5.16.4[7f645d66f000+1eb000]
Aug 03 18:03:17 vm-arch kernel: audit: type=1701 audit(1564848197.113:57): auid=1000 uid=1000 gid=998 ses=2 pid=450 comm="kwin_wayland" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 03 18:03:17 vm-arch audit[450]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=450 comm="kwin_wayland" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 03 18:05:32 vm-arch kernel: audit: type=1701 audit(1564848332.356:38): auid=1000 uid=1000 gid=998 ses=2 pid=448 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 03 18:05:32 vm-arch audit[448]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=448 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 12:22:16 vm-arch audit[3307]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=3307 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 12:22:16 vm-arch kernel: audit: type=1701 audit(1565518936.686:44): auid=1000 uid=1000 gid=998 ses=2 pid=3307 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 12:36:50 vm-arch audit[450]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=450 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 12:36:50 vm-arch kernel: audit: type=1701 audit(1565519810.083:42): auid=1000 uid=1000 gid=998 ses=2 pid=450 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
                                            Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
Aug 11 12:49:23 vm-arch kdeinit5[750]: kio_smb: dirp->name  kwin.txt   "kwin.txt"  ' "" '   8
Aug 11 12:49:23 vm-arch kdeinit5[750]: kio_smb: updateCache  "/red/kwin.txt"
Aug 11 12:49:24 vm-arch kdeinit5[743]: kio_smb: dirp->name  kwin.txt   "kwin.txt"  ' "" '   8
Aug 11 12:49:24 vm-arch kdeinit5[743]: kio_smb: updateCache  "/red/kwin.txt"
Aug 11 12:51:10 vm-arch systemsettings5[758]: org.kde.kcoreaddons: Error loading plugin "kcm_kwindecoration" "The shared library was not found." 
Aug 11 12:51:10 vm-arch systemsettings5[758]: Module 'org.kde.kwin.decoration' does not contain a module identifier directive - it cannot be protected from external registrations.
Aug 11 12:51:13 vm-arch systemsettings5[758]: KActivitiesStats( 0x55c343144b00 ) ResultModelPrivate::onResultScoreUpdated  result added: "kcm:kwindecoration.desktop" score: 0 last: 1565520673 first: 1565520673
Aug 11 12:55:09 vm-arch audit[451]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=451 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 12:55:09 vm-arch kernel: audit: type=1701 audit(1565520909.576:44): auid=1000 uid=1000 gid=998 ses=2 pid=451 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 13:27:19 vm-arch audit[450]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=450 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 13:27:19 vm-arch kernel: audit: type=1701 audit(1565522839.420:45): auid=1000 uid=1000 gid=998 ses=2 pid=450 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 13:28:03 vm-arch audit[453]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=453 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 11 13:28:03 vm-arch kernel: audit: type=1701 audit(1565522883.836:42): auid=1000 uid=1000 gid=998 ses=2 pid=453 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
                                           Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
Aug 11 13:29:02 vm-arch systemsettings5[660]: org.kde.kcoreaddons: Error loading plugin "kcm_kwindecoration" "The shared library was not found." 
Aug 11 13:29:02 vm-arch systemsettings5[660]: Module 'org.kde.kwin.decoration' does not contain a module identifier directive - it cannot be protected from external registrations.
Aug 11 13:29:06 vm-arch systemsettings5[660]: KActivitiesStats( 0x5623a676c970 ) ResultModelPrivate::onResultScoreUpdated  result added: "kcm:kwindecoration.desktop" score: 1 last: 1565522942 first: 1565520673
Aug 12 08:04:23 vm-arch audit[447]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=2 pid=447 comm="kwin_wayland" exe="/usr/bin/kwin_wayland" sig=6 res=1
Aug 12 08:04:23 vm-arch kernel: audit: type=1701 audit(1565589863.056:124): auid=1000 uid=1000 gid=998 ses=2 pid=447 comm="kwin_wayland" exe="/usr/bin/kwin_wayland" sig=6 res=1
Aug 12 08:04:31 vm-arch systemd-coredump[6705]: Process 447 (kwin_wayland) of user 1000 dumped core.
Aug 12 08:34:51 vm-arch audit[6793]: ANOM_ABEND auid=1000 uid=1000 gid=998 ses=5 pid=6793 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Aug 12 08:34:51 vm-arch kernel: audit: type=1701 audit(1565591691.453:148): auid=1000 uid=1000 gid=998 ses=5 pid=6793 comm="QDBusConnection" exe="/usr/bin/kwin_wayland" sig=11 res=1
Comment 1 Miroslav Spehar 2019-08-12 17:35:33 UTC
Created attachment 122091 [details]
kubuntu htop showing cpu usage

same thing happens on kubuntu with latest updates. i uninstalled plasma-discover and disabled ubuntu.

cpu spike is triggered when kscreen locker kicks in
Comment 2 Miroslav Spehar 2019-08-12 17:37:33 UTC
*disabled baloo
Comment 3 Martin Flöser 2019-08-13 10:31:40 UTC
You are running multiple KWin instances. This is probably the reason for the high cpu usage. Please kill the additional ones.
Comment 4 Miroslav Spehar 2019-08-13 18:13:25 UTC
after reinstallation of virtual machine, same situation again.
post installaton steps:
- update all packages
- remove plasma-discover
- install openssh-server
- apt autoremove
- configure autologin to wayland session in plasma settings


status after reinstall:
- cpu is ~25% while lockscreen is on
- after monitors are turned off, session cannot be recovered via gui


if i kill one of the other processes, session crashes.
fwiw, i do not start manually those kwin processes, they are started by sddm it seems. i added a screenshot of htop with hierarchy.
Comment 5 Miroslav Spehar 2019-08-13 18:13:39 UTC
Created attachment 122102 [details]
25% cpu kwin
Comment 6 thenujan 2022-10-11 16:36:36 UTC
Created attachment 152710 [details]
Screenshot of htop with  close to 100% cpu usage

Same happens in my manjaro machine nearly 100% cpu when logging into wayland
Comment 7 thenujan 2022-10-11 16:43:45 UTC
Created attachment 152711 [details]
Htop showing the command of the  kwin_wayland process taking high cpu usage