Bug 502432

Summary: kdeplasma-addons comic git e0e40e77be8989a303d6a9173d2bfcb39d3d6d47 sends plasmashell into memory-eating loop before display
Product: [Plasma] plasmashell Reporter: Duncan <1i5t5.duncan>
Component: Comic widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: cwo.kde
Priority: NOR Keywords: regression
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Duncan 2025-04-05 01:21:12 UTC
This is with git master frameworks and plasma, using the gentoo/kde project overlay live ebuilds for that purpose.  Qt 6.8.3 on Wayland (no x but xwayland).  After updating an hour or so ago kdeplasma-addons HEAD is 97a8e0a224e30ded9c223913abb60403a53a6ef5 which is still broken, while I've bisected to (emails munged):

commit e0e40e77be8989a303d6a9173d2bfcb39d3d6d47
Author:     Christoph Wolk <cwo.kde@>
AuthorDate: Sat Mar 22 07:39:26 2025 +0100
Commit:     Christoph Wolk <cwo.kde@>
CommitDate: Tue Mar 25 14:39:33 2025 +0000

applets/comic: separate representations and use PlaceholderMessage


I have a comic plasmoid configured in a (left side) autohide panel (it's the only applet in that panel, which is configured rather large to show the comics).  At that commit plasmashell goes into an endless loop before displaying anything.  It will slowly eat memory and an strace shows it MADVISEing and allocating memory in a loop, while grabbing 100% CPU on one hyperthread.

In case it matters, the comics I have configured are NASA APOD, Questionable Content, and XKCD.

According to that git description, that commit is supposed to change the comic layout.  While I'm not a coder, what I'm wondering is if it can't handle the old comic layout and needs an update script to convert it to something the new code can handle.
Comment 1 Duncan 2025-04-05 01:23:58 UTC
CCing commit author/committer
Comment 2 Duncan 2025-04-05 01:25:45 UTC
+keyword: regression
Comment 3 Duncan 2025-04-05 03:00:36 UTC
BTW, I forgot to say it earlier; thanks for the badly needed comic applet updates.  =:^)

Meanwhile, here's the entire plasma-org.kde.plasma.desktop-appletsrc set of sections for that panel, including its comic applet.  If I delete this, or just the applets 87 sections, plasma starts properly again.

[Containments][103]
activityId=
formfactor=3
immutability=1
lastScreen=1
location=5
plugin=org.kde.panel
wallpaperplugin=org.kde.image

[Containments][103][Applets][87]
immutability=1
plugin=org.kde.plasma.comic

[Containments][103][Applets][87][Configuration]
PreloadWeight=26
arrowsOnHover=true
checkNewComicStripsIntervall=30
comic=apod
lastStripVisited_apod=true
lastStripVisited_questionable_content=true
lastStripVisited_xkcd=true
lastStrip_apod=
lastStrip_questionable_content=
lastStrip_xkcd=
maxComicLimit=29
maxStripNum_apod=0
maxStripNum_questionable_content=5512
maxStripNum_xkcd=2977
middleClick=true
popupHeight=550
popupWidth=770
savingDir=/h/x/dt
scaleToContent_apod=false
scaleToContent_questionable_content=false
scaleToContent_xkcd=false
showComicAuthor=true
showComicIdentifier=true
showComicTitle=true
showComicUrl=true
showErrorPicture=true
storedPosition_apod=
storedPosition_questionable_content=
storedPosition_xkcd=
tabIdentifier=apod,questionable_content,xkcd

[Containments][103][Applets][87][Configuration][ConfigDialog]
DialogHeight=540
DialogWidth=720

[Containments][103][General]
AppletOrder=87
Comment 4 Duncan 2025-04-05 03:24:47 UTC
(In reply to Duncan from comment #0)
> According to that git description, that commit is supposed to change the
> comic layout.  While I'm not a coder, what I'm wondering is if it can't
> handle the old comic layout and needs an update script to convert it to
> something the new code can handle.

Nope!  Deleting the affected appletsrc config and starting plasmashell, then attempting to add a comic strip plasmoid (so it's trying to use the new default config, which I was expecting to have to re-add my selected comics to), resulted in the same behavior -- a frozen plasmashell display (because it was already running and had thus already displayed) with a stuck core -- I didn't wait long enough to see if it was eating memory; I just did a killall -2 plasmashell (plasmashell seems to ignore the default, IIRC -15).
Comment 5 Bug Janitor Service 2025-04-05 06:42:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kdeplasma-addons/-/merge_requests/736
Comment 6 cwo 2025-04-05 06:46:57 UTC
Thanks for the bug report and helping test the development versions!

I was able to reproduce the issue; there's some complexity that happens with very large panels that I didn't notice while testing with narrow panels and desktop widgets. The above MR makes it work for me.
Comment 7 Duncan 2025-04-05 09:48:17 UTC
(In reply to cwo from comment #6)

Confirming the patch/MR fixes it. =:^)

Plus with your updates another bug seems to be gone -- the long-term one (since the comic plasmoid introduction?) where (with multiple source-comics configured) leaving the comic on anything but the first source would DoS the server of (I think) the last one (XKCD in my case)! =:^)

> Thanks for the bug report and helping test the development versions!

My geek/ASD hobby, live-git nearly all of my ~150 kde packages (plus a few others I track), debugging/bisecting and reporting when necessary.  It's the perfect balance of working most of the time but with the occasional "challenge" to keep things interesting!  Plus the bonus of the occasional git tracking pointer to interesting lines where even a non-dev can decide to nudge a value just a bit with their own patch.  Gentoo makes it easy!

> I was able to reproduce the issue; there's some complexity that happens with
> very large panels that I didn't notice while testing with narrow panels and
> desktop widgets. The above MR makes it work for me.

I hadn't thought of the "large panel" factor.

Thanks again for the work -- I don't have to kick myself any more for DoSing the poor comic hosts every time I forget to click back to the first source again, making it well worth the "challenge" of doing without plasmashell for a few days (fortunately I have a pdmenu launcher setup for anything worth the trouble, and krunner/konsole on direct hotkeys to run anything else)... and I'm sure the comic hosts will be thanking you too! =:^)
Comment 8 cwo 2025-04-05 10:58:22 UTC
(In reply to Duncan from comment #7)
> Plus with your updates another bug seems to be gone -- the long-term one
> (since the comic plasmoid introduction?) where (with multiple source-comics
> configured) leaving the comic on anything but the first source would DoS the
> server of (I think) the last one (XKCD in my case)! =:^)

Yes, that was fixed with https://invent.kde.org/plasma/kdeplasma-addons/-/merge_requests/711 - switching to another tab would basically make it think it was checking for updates, and that check would make it think it was switching tabs, and that would make it think it was checking for updates etc.

I've got a couple more things that need to be tweaked so that the widget is as well-functioning as I can make it, so if you notice something else broke please file a bug (and CC me on it) – I try to test everything, but there will be gaps where I don't think of something (like the very large panel case here – I'll keep one around for testing now while I'm working on it).
Comment 9 cwo 2025-04-07 15:48:40 UTC
Git commit 643bc926bf991f7fe915d83977176c97ec6b39af by Christoph Wolk.
Committed on 07/04/2025 at 15:33.
Pushed by cwo into branch 'master'.

applets/comic: wrap fullRepresentation in Item

The previously used complex anchor setup was replaced with a simple
layout in c76ca0ac. This works fine for desktop widgets or panel popups,
but confuses the panel logic if the fullRepresentation is shown directly
in a very large panel, causing an endless loop if more than one thing is
visible at the same time (such as the main comic view and e.g. the tab
bar or the comic title label).

Instead, wrap the fullRepresentation in an Item, which solves the issue.

M  +96   -93   applets/comic/package/contents/ui/main.qml

https://invent.kde.org/plasma/kdeplasma-addons/-/commit/643bc926bf991f7fe915d83977176c97ec6b39af