Bug 424636

Summary: System monitors leak memory, to a tune of 1GB (!) every 24 hours.
Product: [Plasma] plasmashell Reporter: Gilboa Davara <gilboad>
Component: System MonitorAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: normal CC: alex, arojas, homonomonom1984, nate, plasma-bugs, sonichedgehog_hyperblast00
Priority: VHI Keywords: regression
Version: 5.19.3   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.75
Sentry Crash Report:

Description Gilboa Davara 2020-07-25 05:36:04 UTC
SUMMARY
Just upgrade two of my Fedora KDE boxes to 5.19.x and I'm noticing huge memory leak from plasmashell.
I'm putting the blame on the system monitors, as removing them all seems to solve the problem.
I literally have to reset plasmashell (kquitapp plsamshell && plasmashell &) as it eats ~30GB of RAM. (Both machine have 32GB RAM).
Reverting back to 5.18 solves the problem.

OBSERVED RESULT
Memory usage (Please note that the session is completely idle and locked; numbers take via ssh)
$ date && top -b 1 -n1 -p $(pgrep plasmashell) | /bin/egrep -e 'plasmashell|PID'
Fri 24 Jul 2020 09:02:49 IDT
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
1357224 gilboa    20   0 2116844 329348 153764 S   0.0   1.0   0:07.32 plasmashell

$ date && top -b 1 -n1 -p $(pgrep plasmashell) | /bin/egrep -e 'plasmashell|PID'
Fri 24 Jul 2020 09:45:46 IDT
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
1357224 gilboa    20   0 2116820 306656  75976 S   6.7   0.9   0:26.78 plasmashell

$ date && top -b 1 -n1 -p $(pgrep plasmashell) | /bin/egrep -e 'plasmashell|PID'
Sat 25 Jul 2020 08:30:58 IDT
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
1357224 gilboa    20   0 4495416   1.5g 174992 S   0.0   4.7  12:44.96 plasmashell


SOFTWARE/OS VERSIONS
Operating System: Fedora 32
KDE Plasma Version: 5.19.3
KDE Frameworks Version: 5.72.0
Qt Version: 5.14.2
Kernel Version: 5.7.8-200.fc32.x86_64
OS Type: 64-bit
Processors: 40 × Intel® Xeon® CPU E5-2658 v2 @ 2.40GHz
Memory: 31.3 GiB of RAM
Graphics Processor: GeForce GTX 1080/PCIe/SSE2
Comment 1 Gilboa Davara 2020-07-26 15:56:58 UTC
Short update: 48h later, had to kill plasmashell when it ate >20GB.
Comment 2 Gilboa Davara 2020-07-27 15:51:48 UTC
Eeek. Less than 24 hours later.
Mon 27 Jul 2020 06:33:11 PM IDT
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
2022829 gilboa    20   0 9922852   7.3g 228252 S   0.0  23.4  15:37.82 plasmashell


I'll try and delete all CPU monitors (keeping disk, memory and network monitors) and see if it helps.
Comment 3 Nate Graham 2020-09-18 21:32:32 UTC
*** Bug 426539 has been marked as a duplicate of this bug. ***
Comment 4 Arjen Hiemstra 2020-10-06 10:15:38 UTC
Git commit b06031fd5439715f7396471f8e8555a5e7bd4edf by Arjen Hiemstra.
Committed on 06/10/2020 at 09:58.
Pushed by ahiemstra into branch 'master'.

Delete all child nodes when resetting the segments in line chart node

Apparently being owned by the parent does not mean removeChild cleans
things up so we have to do that manually.

M  +1    -0    src/scenegraph/LineChartNode.cpp

https://invent.kde.org/frameworks/kquickcharts/commit/b06031fd5439715f7396471f8e8555a5e7bd4edf
Comment 5 Nate Graham 2020-10-06 13:26:16 UTC
We think the above commit may have fixed the issue. Can you test with Frameworks 5.75 once it's released next month? Please feel free to re-open the bug if you're still seeing the issue with Frameworks 5.75.
Comment 6 Antonio Rojas 2020-10-06 15:31:03 UTC
(In reply to Nate Graham from comment #5)
> We think the above commit may have fixed the issue. Can you test with
> Frameworks 5.75 once it's released next month? Please feel free to re-open
> the bug if you're still seeing the issue with Frameworks 5.75.

5.75 is already tagged, this won't be included unless you ask David for a respin
Comment 7 Nate Graham 2020-10-06 15:58:15 UTC
So it has, thanks for the reminder. I'll send an email.
Comment 8 Alex 2020-10-07 15:20:10 UTC
I applied the patch to 5.74 and it seems to have helped but I think plasmashell is still leaking.  I've lost about 100 MB in the last 24 hours.
Comment 9 Alex 2020-10-08 21:28:01 UTC
Alright, everything seems quite good after several days.  Memory usage has come back down and the patch appears to function well.  Memory is below 200MB after 3 days.  Thanks!
Comment 10 Nate Graham 2020-10-08 21:38:39 UTC
Phew! Thanks for checking.
Comment 11 Gilboa Davara 2020-10-12 08:53:25 UTC
Thanks all!