Bug 432449 - Memleak in plasmashell 5.20.5
Summary: Memleak in plasmashell 5.20.5
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-performance (other bugs)
Version First Reported In: 5.20.5
Platform: openSUSE Linux
: NOR major
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland-only
: 432872 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-02-03 06:43 UTC by Fabian Otto
Modified: 2022-02-19 04:36 UTC (History)
10 users (show)

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


Attachments
PlasmaShell Log (34.84 KB, text/plain)
2022-01-20 12:44 UTC, Behzad A
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Otto 2021-02-03 06:43:17 UTC
SUMMARY
Memleak on openSUSE Tumbleweed.
Keeps increasing RES

STEPS TO REPRODUCE
1. Start plasma desktop and check RES in htop
2. wait a few hours. Normal activity
3. check again for RES in htop

OBSERVED RESULT
RES has more than doubled in size. 
Biggest observed yet: around 1400MB

EXPECTED RESULT
RES is the same as when it was started.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.20.5 / openSUSE Tumbleweed 20210131
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2021-02-03 17:52:13 UTC
What's the process that's increasing in memory use?
Comment 2 Fabian Otto 2021-02-05 13:47:33 UTC
(In reply to Nate Graham from comment #1)
> What's the process that's increasing in memory use?

plasmashell itself.

This was on wayland btw.
Comment 3 Henrique Sant'Anna 2021-02-10 00:52:43 UTC
I realized memory leak once while using slideshow as wallpaper on the desktop (X11). Setting plain color as wallpaper fixed that.

Anyway, this increasing memory usage can be caused by any widget set in desktop or in panels. So, disabling some widgets and waiting the same time could help to discover which one is causing the memory leak.

There is also some users reporting that using some plasma theme (style) could get plasma to memory leak. So maybe it's a case of testing plasma with its default themes, breeze and dark breeze.
Comment 4 David Edmundson 2021-02-22 23:29:40 UTC
This doesn't have enough information to act on.

Please test removing widgets or get a heaptrack log.
Comment 5 Fabian Otto 2021-02-23 07:02:28 UTC
(In reply to David Edmundson from comment #4)
> This doesn't have enough information to act on.
> 
> Please test removing widgets or get a heaptrack log.

There are no widgets installed besides the default ones. The used theme is unmodified Breeze Dark. The Problem only exists in wayland.
Comment 6 Bug Janitor Service 2021-03-10 04:33:42 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 7 Nate Graham 2021-03-10 14:41:38 UTC
Can you get a heaptrack log?
Comment 8 Fabian Otto 2021-03-10 20:03:14 UTC
(In reply to Nate Graham from comment #7)
> Can you get a heaptrack log?

here you go. Heaptrack of plasmashell 5.21.1 but same problem still.
https://mega.nz/file/hPxk0ZyC#0GA7VZh0OdkRsydChjollNYAMJoKgaM9ol-4n_V6QWw
Comment 9 Nate Graham 2021-03-11 22:25:13 UTC
Thanks!
Comment 10 David Edmundson 2021-03-14 18:53:18 UTC
*** Bug 432872 has been marked as a duplicate of this bug. ***
Comment 11 David Edmundson 2021-03-14 19:06:56 UTC
Framegraph shows two distinct areas of usage at peak:
 - Appstream (150Mb)
 - Your graphic drivers (300Mb)

Neither of which seem ideal.


Can you confirm that krunner also spirals out of control after doing a query?
and if you get high usage in systemsettings5
Comment 12 Vlad Zahorodnii 2021-03-16 19:13:20 UTC
Do you use any third party wallpaper plugin? Also, the provided archive file seems corrupted

plasmashell.5011.zst : 124 MB...     plasmashell.5011.zst : Read error (39) : premature end
Comment 13 Fabian Otto 2021-03-18 11:21:07 UTC
(In reply to David Edmundson from comment #11)
> Framegraph shows two distinct areas of usage at peak:
>  - Appstream (150Mb)
>  - Your graphic drivers (300Mb)
> 
> Neither of which seem ideal.
> 
> 
> Can you confirm that krunner also spirals out of control after doing a query?
> and if you get high usage in systemsettings5

I can confirm, that krunner too also starts to memleak after doing a query.
 
Heaptrackfile for it here:
https://mega.nz/file/cPxEiY4S#zWyWEXuuxAZ0m48b-ErL0ub2lG239skJWjgBef23RyU

```
total runtime: 74.23s.
calls to allocation functions: 8103421 (109173/s)
temporary memory allocations: 539318 (7265/s)
peak heap memory consumption: 101.37MB
peak RSS (including heaptrack overhead): 272.14MB
total memory leaked: 98.78MB
```

As for systemsettings5 I do not get  high resource usage here. Neither in RAM nor CPU.
Comment 14 Fabian Otto 2021-03-18 11:23:00 UTC
(In reply to Vlad Zahorodnii from comment #12)
> Do you use any third party wallpaper plugin? Also, the provided archive file
> seems corrupted
> 
> plasmashell.5011.zst : 124 MB...     plasmashell.5011.zst : Read error (39)
> : premature end

I do not use anything third party. Only what came with the package.
Also here is a new heaptrack file. No idea why the last one had problems for you.
See also my reply to David Edmundson for the heaptrack file for krunner.

https://mega.nz/file/QXhQXaJI#P0sthT8xFG7FU8ZyVYuXYogD1-Yko9vfdqt8dvz495s
Comment 15 Reiddragon 2021-06-19 17:58:30 UTC
Confirmed this on 5.20.90, 5.21 and 5.21.1 on Arch as well, doesn't seem to be related to anything 3rd party
Might be related to searches to some degree as many successive queries can easily add a full 200MB to `plasmashell`'s usage (on top of its usage after a cold boot), however this might just be coincidental as it doesn't break past 400MB total with searches alone but the leak seems to easily get to almost 1GiB
Comment 16 Behzad A 2021-06-19 22:11:36 UTC
I have the same issue on Wayland

Plasmashell uses about 200MB of resources in cold-boot, but after few hours of normal use, Plasmashell resource usage increases to more than 900MB.

I don't use any widget or Krunner and this issue happens even when right after boot I just opening a web browser(Chrome or Edge) and doing web browsing for few hours without using any other application.


Operating System: openSUSE Tumbleweed 20210616
KDE Plasma Version: 5.22.0
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel-Version: 5.12.10-1-default (64-bit)
Graphics Platform: Wayland
Processors: 2 × Intel® Core™2 Duo CPU T6670 @ 2.20GHz
Memory: 3.7 GiB of RAM
Graphics Processor: Mesa DRI Mobile Intel® GM45 Express Chipset
Comment 18 David Edmundson 2021-06-20 19:34:28 UTC
I went through heaptrack, thanks.

All leaks and peak usage are inside mesa in the Intel driver (unfortunately exact locations within mesa are unresolved)

This /could/ still mean plasma or Qt is at fault missing some GL calls to remove textures, but it seems unlikely given we claim it came in for 5.20.5 and I can't think of anything changed in plasma in there. 

Most likely this points to a driver bug. 
If you are in a position to upgrade/downgrade mesa that would really help.
Comment 19 Fabian Otto 2021-06-20 20:48:17 UTC
(In reply to David Edmundson from comment #18)
> I went through heaptrack, thanks.
> 
> All leaks and peak usage are inside mesa in the Intel driver (unfortunately
> exact locations within mesa are unresolved)
> 
> This /could/ still mean plasma or Qt is at fault missing some GL calls to
> remove textures, but it seems unlikely given we claim it came in for 5.20.5
> and I can't think of anything changed in plasma in there. 
> 
> Most likely this points to a driver bug. 
> If you are in a position to upgrade/downgrade mesa that would really help.

I did go through the heaptrack as well, what made me question whether it's actually a driver bug though is twofold:

1. It's not a problem on Xorg
2. GNOME Wayland should use the same calls if it IS a Vulkan or OpenGL driver implementation thing. So if that was the case GNOME's memory usage should go up too. It does not however. So either there is a call being used or not being that GNOME simply does not touch or it's something else.

Then again I'm not a programmer and this is just conjecture on my part. My reasoning might be flawed.

As for it starting in 5.20.5 it could not swear on it, that was just when I first took notice of it. Might have been introduced earlier than that.
Comment 20 Quartz 2021-10-21 18:20:51 UTC
Bump x7. 

I'd appreciate if this bug takes priority - it might be causing other accidental threads being created in relation to memory leaks and mistaking side effects in other places (such as I did with plasma widgets).

It makes it impossible to keep a desktop linux distro running KDE for several days and it's making the desktop environment give a really poor impression and experience.
Comment 21 David Edmundson 2022-01-12 15:18:37 UTC
Behzad, Fabian, can you confirm if you still have an issue with newer drivers.
Comment 22 Behzad A 2022-01-20 12:44:14 UTC
Created attachment 145662 [details]
PlasmaShell Log

(In reply to David Edmundson from comment #21)
> Behzad, Fabian, can you confirm if you still have an issue with newer
> drivers.

I am now using Crocus Driver instead of i965 for a few months for the daily drive(Current Ver is Mesa 22.0 Git Devel), and this issue still exists for me with both of them in Plasma 5.23.5.

And for me, popup notifications is one of the memory leak reasons(As you can see in the video), also a lot of Plasmashell warning about "Couldn't create KWindowShadow" logged in SysJournal(Especially look at warning logged when I recorded video in 13:40-41)

https://youtu.be/Zj0PdAkxkDw

System Info

System:    Host: localhost.localdomain Kernel: 5.16.0-1-default x86_64 bits: 64 compiler: gcc v: 11.2.1
           Desktop: KDE Plasma 5.23.5 tk: Qt 5.15.2 wm: kwin_wayland dm: SDDM Distro: openSUSE Tumbleweed 20220111
CPU:       Info: Dual Core model: Intel Core2 Duo T6670 bits: 64 type: MCP arch: Penryn rev: A cache: L2: 2 MiB
           flags: lm nx pae sse sse2 sse3 sse4_1 ssse3 vmx bogomips: 8771
           Speed: 1280 MHz min/max: 1200/2201 MHz boost: enabled Core speeds (MHz): 1: 1280 2: 1930
Graphics:  Device-1: Intel Mobile 4 Series Integrated Graphics vendor: Sony driver: i915 v: kernel bus-ID: 00:02.0
           chip-ID: 8086:2a42
           Device-2: Ricoh Sony Vaio Integrated Webcam type: USB driver: uvcvideo bus-ID: 1-2:2 chip-ID: 05ca:18b3
           Display: wayland server: X.org 1.21.1.3 compositor: kwin_wayland driver: loaded: modesetting unloaded: fbdev,vesa
           alternate: intel resolution: <missing: xdpyinfo>
           OpenGL: renderer: Mesa Mobile Intel GM45 Express (CTG) v: 2.1 Mesa 22.0.0-devel-git-8d2be391 direct render: Yes
Comment 23 Bug Janitor Service 2022-02-04 04:37:27 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 24 Bug Janitor Service 2022-02-19 04:36:49 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!