https://bugs.kde.org/show_bug.cgi?id=526663

            Bug ID: 526663
           Summary: Battery widget freezes plasmashell at 100% CPU when an
                    app leaks many power inhibitions
    Classification: Plasma
           Product: plasmashell
      Version First 6.7.5
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: Power and Battery  widget
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
  Target Milestone: 1.0

DESCRIPTION

When an application repeatedly leaks power management inhibitors without
releasing them, the KDE Plasma Battery applet causes plasmashell to freeze and
consume excessive CPU and memory (due to inefficient delegate management). 

***
LocalSend 1.17.0 requests an idle/wakelock inhibitor every ~20 seconds and
never releases it. Accumulated over a few days:
$ busctl --user get-property org.kde.Solid.PowerManagement \
    /org/kde/Solid/PowerManagement/PolicyAgent \
    org.kde.Solid.PowerManagement.PolicyAgent RequestedInhibitions | head -c
160
a(ssssu) 2233 "idle" "localsend_app" "wakelock" "block" 3 "idle"
"localsend_app" ...
2,233 entries, all identical. The D-Bus response payload is 97 KB.

STEPS TO REPRODUCE
1/ Run an application that leaks/accumulates inhibitors (any will do -
LocalSend 1.17.0 reproduces this reliably).
2/ Wait until several hundred entries accumulate (check using the command
above).
3/ System Tray ==> "Battery and Brightness" ==> Always shown.
4/ Restart plasmashell.

OBSERVED RESULT
battery in shownItems - CPU time in 90s - 0:43, growing, RSS 1.9 GB, growing,
D-bus unresponsive
battery not pinned - CPU time in 90s 0:02, flat, RSS 551 MB, flat , D-Bus
responsive 

EXPECTED RESULT
in both as battery not pinned

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 6.7.5
KDE Frameworks Version: 6.30.0
Qt Version: 6.11.2
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Related Report
Same behavior observed with Firefox instead of LocalSend (hundreds of "firefox
video-playing" entries, Plasma pegs 100% CPU):
https://discuss.kde.org/t/plasmashell-freezes-when-unblock-app-in-battery/23647

ROOT CAUSE

`requestedInhibitions` is exposed to QML as a plain JavaScript array, which is
recreated every time the property is read
thus, its object identity always changes. 
Repeater never computes or applies a diff - it performs a full clear() followed
by a complete rebuild of all N delegates. 
Additionally, `InhibitionControl::updatedInhibitions()` invokes
`populateApplicationData()` (performing a KService lookup) for every single
entry.
With several hundred entries, a single rebuild cycle takes longer than the
update interval, causing the shell's event loop to fall behind indefinitely.
This issue only surfaces when the applet is instantiated - i.e. when the
battery icon is pinned to Always shown or when the system tray popup is open.
As a result, it masquerades as a panel or system tray bug rather than a battery
applet issue. the panel fails to repaint, stops responding to clicks, and
stalls on processing D-Bus messages. Consequently, kquitapp6 plasmashell hangs
indefinitely, making restart scripts appear broken.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to