Bug 466319 - Opening the phone menu of kdeconnect widget causes memory leak
Summary: Opening the phone menu of kdeconnect widget causes memory leak
Status: RESOLVED WORKSFORME
Alias: None
Product: kdeconnect
Classification: Applications
Component: plasmoid (other bugs)
Version First Reported In: 22.12.2
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-23 20:02 UTC by rob.dyck
Modified: 2023-04-22 03:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Laptop died, took photo of memory usage (158.39 KB, image/jpeg)
2023-02-25 21:32 UTC, rob.dyck
Details
plasmashell crash log (47.54 KB, text/plain)
2023-02-26 19:50 UTC, rob.dyck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rob.dyck 2023-02-23 20:02:26 UTC
SUMMARY
Opening the menu of the kdeconnect widget causes memory leak


STEPS TO REPRODUCE
1. Click on the phone's menu in the connect widget.
2. In a terminal open top


OBSERVED RESULT
CPU spike in plasmashell. kwinwayland and kdeconnect
Memory usage in plasmashell starts going up
The high CPU eventually stops but plasmashell memory does not recover

EXPECTED RESULT
Any CPU spike should be brief
Plasmashell memory should not grow

SOFTWARE/OS VERSIONS


Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.27
KDE Frameworks Version: 5.103
Qt Version: 5.15.8

ADDITIONAL INFORMATION

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                
   1349 rdyck     20   0 3260244   1.2g 152380 R  65.9  10.4  11:52.66 plasmashell                                                                            
   1236 rdyck     20   0 1368132 191372 147256 S  43.7   1.6   7:20.29 kwin_wayland                                                                           
   8581 rdyck     20   0 1191940 112100  92132 S  32.1   0.9   0:44.14 kdeconnectd
Comment 1 rob.dyck 2023-02-23 20:44:37 UTC
Serious poblem. Using the phone for remote input will eventually exhaust the memory.
Comment 2 rob.dyck 2023-02-25 21:32:27 UTC
Created attachment 156732 [details]
Laptop died, took photo of memory usage

Since the laptop had died I was unable to take a screen shot so I photographed it.
Comment 3 rob.dyck 2023-02-26 19:50:58 UTC
Created attachment 156762 [details]
plasmashell crash log

Shortly after booting I noticed that plasmashell memory usage had taken a big jump. I also noticed that the process ID had changed. So I collected the logs from where it started and to where it crashed.
Comment 4 rob.dyck 2023-03-02 19:42:21 UTC
Updated to plasma 5.27.2.
Plasmashell still not reclaiming memory.
Comment 5 Fushan Wen 2023-03-20 12:26:50 UTC
How to reproduce the leak? By repeat clicking on the phone's menu?
Comment 6 rob.dyck 2023-03-20 16:05:02 UTC
In the widget where my phone appears there is a hamburger menu. BTW the widget has an annoying habit.  The widget goes into edit mode whenever the menu is clicked.

I have a more reliable way to get the memory to increase. I send an email to my phone and when the notification appears in the widget the memory use increases.

On my laptop ( not my main machine at home ) the plasmashell memory usage seems to increase spontaneously. Another peculiar thing I have noticed with the laptop is that a battery trouble seemed to have an influence. At the time I reported this my laptop was reporting that the battery didn't exist. The memory use would take huge junps and the laptop would shutdown perhaps within an hour. This was mentioned in the comments previously. Any way a battery was on order and has now arrived. The problem with huge jumps in plasmashell memory use seems to have stopped. Just much smaller junps now.
Comment 7 rob.dyck 2023-03-20 16:25:45 UTC
More information. When the email notification arrives This log happens -------
Mar 20 09:20:48 blacky plasmashell[269885]: org.kde.plasma.notifications: Notification to send to backend contains invalid XML:  "Opening and ending tag mismatch." line 1 col 100
Mar 20 09:20:48 blacky plasmashell[269885]: Could not find the Plasmoid for Plasma::FrameSvgItem(0x55a468262ee0) QQmlContext(0x55a465913120) QUrl("file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/global/Globals.qml")
Mar 20 09:20:48 blacky plasmashell[269885]: Could not find the Plasmoid for Plasma::FrameSvgItem(0x55a468262ee0) QQmlContext(0x55a465913120) QUrl("file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/global/Globals.qml")
Comment 8 Fushan Wen 2023-03-20 17:24:05 UTC
This looks like a memory leak in Mesa if it's related to notification.
Comment 9 rob.dyck 2023-03-20 18:00:54 UTC
Disregard what I said about the laptop battery problem. It doesn't seem to be the battery itself. The laptop just reported that the battery didn't exist. Clearly I have a trouble  with this laptop.

However it did trigger a huge jump in the plasmashell memory useage.

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                
   1211 rdyck     20   0 5945024   3.0g 149600 S   0.0  38.6   2:07.61 plasmashell
Comment 10 Albert Vaca Cintora 2023-03-23 18:01:33 UTC
Please provide some steps to reproduce the memory leak, after reading your messages I'm still not sure what to do (receive notifications? use remote input?).
Comment 11 rob.dyck 2023-03-23 21:34:59 UTC
I have been playing with this occasionly and I cannot consistently make it happen. Then there is the wierd thing that happens with my laptop. From time to time it thinks that the battery has disappeared. When that happens plasmashell grabs a huge amount of memory, 3 gig, and never releases it. In my original report I observed the trouble when I opened the hamburger menu in kdeconnect. I have since seen it happen when opening in other widgets but again not consistently. Now I am pretty sure that some notifications trigger it as well.

When I watch "top" for a while I can see the spikes when notifications arrive. Most of the added memory is only held for a short time but it doesn' quite get down to its previous level.

With a fresh login and with my desktop set up to my taste I observed that plasmashell was holding on to 365512 according to top. After three days almost exactly, plasmashell was using 516484.

I got started on this quest because my laptop was dying due to memory exhaustion. I then decided to compare it with my main computer. It hadn't been dying but I did observe the memory usage rising with time.

I am currently on 5.27.3.
Comment 12 Bug Janitor Service 2023-04-07 03:45:37 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Bug Janitor Service 2023-04-22 03:45:52 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!