Bug 428394 - huge memory leak
Summary: huge memory leak
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-performance (other bugs)
Version First Reported In: 5.25.2
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland-only
: 441213 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-10-28 14:21 UTC by Germano Massullo
Modified: 2024-10-05 06:12 UTC (History)
14 users (show)

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


Attachments
GDB (37.97 KB, text/plain)
2020-10-28 14:21 UTC, Germano Massullo
Details
heaptrack file (1.20 MB, application/zstd)
2020-11-13 11:48 UTC, Germano Massullo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Germano Massullo 2020-10-28 14:21:37 UTC
Created attachment 132840 [details]
GDB

I noticed that my system was swapping and I found out that plasmashell process had reach 10 GB of RAM. I managed to pause it with
$ gdb plasmashell $PID
I attach the backtrace file of GDB and heaptrack


qdbus org.kde.KWin /KWin supportInformation

==========================

Version
=======
KWin version: 5.20.1
Qt Version: 5.15.1
Qt compile version: 5.15.1
XCB compile version: 1.13.1

Operation Mode: Xwayland

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_DRM: yes
HAVE_GBM: yes
HAVE_EGL_STREAMS: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: Fedora Project
Vendor Release: 12009000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Plugin recommends border size: None
Blur: 0
onAllDesktopsAvailable: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 0
gridUnit: 12
font: Droid Sans [1ASC],11,-1,5,50,0,0,0,0,0
smallSpacing: 3
largeSpacing: 12

Platform
==========
Name: DRM
Active: true
Atomic Mode Setting: true
Using EGL Streams: false

Options
=======
focusPolicy: 0
xwaylandCrashPolicy: 
xwaylandMaxCrashCount: 3
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 28
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 28
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 28
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
compositingMode: 1
useCompositing: true
hiddenPreviews: 1
glSmoothScale: 2
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: false
glStrictBindingFollowsDriver: true
glCoreProfile: true
glPreferBufferSwap: 101
glPlatformInterface: 2
windowsBlockCompositing: true

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  yes
Number of Screens: 1

Screen 0:
---------
Name: DP-3
Geometry: 0,0,3072x1728
Scale: 1.25
Refresh Rate: 59.997


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.38.0, 5.8.16-300.fc33.x86_64, LLVM 11.0.0)
OpenGL version string: 4.6 (Core Profile) Mesa 20.2.1
OpenGL platform interface: EGL
OpenGL shading language version string: 4.60
Driver: RadeonSI
GPU class: Arctic Islands
OpenGL version: 4.6
GLSL version: 4.60
Mesa version: 20.2.1
Linux kernel version: 5.8.16
Direct rendering: Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used
Painting blocks for vertical retrace:  no

Loaded Effects:
---------------
kwin4_effect_sessionquit
screenshot
desktopgrid
kwin4_effect_translucency
colorpicker
kwin4_effect_fullscreen
kwin4_effect_frozenapp
presentwindows
kwin4_effect_dialogparent
highlightwindow
blur
contrast
startupfeedback
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
kwin4_effect_sessionquit:
pluginId: kwin4_effect_sessionquit
isActiveFullScreenEffect: false

screenshot:

desktopgrid:
zoomDuration: 300
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

kwin4_effect_translucency:
pluginId: kwin4_effect_translucency
isActiveFullScreenEffect: false

colorpicker:

kwin4_effect_fullscreen:
pluginId: kwin4_effect_fullscreen
isActiveFullScreenEffect: false

kwin4_effect_frozenapp:
pluginId: kwin4_effect_frozenapp
isActiveFullScreenEffect: false

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 150
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

kwin4_effect_dialogparent:
pluginId: kwin4_effect_dialogparent
isActiveFullScreenEffect: false

highlightwindow:

blur:

contrast:

startupfeedback:
type: 1

kscreen:
Comment 1 Germano Massullo 2020-10-28 14:27:34 UTC
unfortunately heaptrack was not able to save anything, probably due lack of free RAM
Comment 2 Justin Zobel 2020-10-28 22:35:27 UTC
(In reply to Germano Massullo from comment #1)
> unfortunately heaptrack was not able to save anything, probably due lack of
> free RAM

Are you able to monitor your session after restarting and try get a heaptrack as it's getting close to consuming your RAM?
Comment 3 Germano Massullo 2020-10-29 00:47:50 UTC
(In reply to Justin Zobel from comment #2)
> (In reply to Germano Massullo from comment #1)
> > unfortunately heaptrack was not able to save anything, probably due lack of
> > free RAM
> 
> Are you able to monitor your session after restarting and try get a
> heaptrack as it's getting close to consuming your RAM?

I will try triggering it again
Comment 4 Germano Massullo 2020-10-29 01:03:36 UTC
I really suspect it may be related to
https://bugs.kde.org/show_bug.cgi?id=428409
Comment 5 David Edmundson 2020-10-29 09:35:33 UTC
Why do you suspect that?
Comment 6 Germano Massullo 2020-10-29 10:24:24 UTC
(In reply to David Edmundson from comment #5)
> Why do you suspect that?

Because I remember starting to get massive I/O from disk after having tried to use it. Just a hypothesis
Comment 7 Bug Janitor Service 2020-11-13 04:33:48 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 8 Germano Massullo 2020-11-13 11:48:37 UTC
Created attachment 133294 [details]
heaptrack file

heaptrack --analyze "/home/user/heaptrack.plasmashell.3791.zst"
/usr/bin/heaptrack: riga 74:  5716 Errore di segmentazione (core dump created) "$EXE_PATH/heaptrack_gui" "$@"


And this is the GDB trace that I got from drkonqi while triggering the problem. I must say that this time (new Plasma version, see details below)  I did not get a big RAM usage, it always stayed in his normal RAM usage range

Application: Plasma (plasmashell), signal: Aborted
Content of s_kcrashErrorMessage: [Current thread is 1 (Thread 0x7f5db79b8940 (LWP 3005))]
[KCrash Handler]
#6  __GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:49
#7  0x00007f5dbb6ff8a4 in __GI_abort () at abort.c:79
#8  0x00007f5dbbb22b07 in qt_message_fatal (message=<synthetic pointer>..., context=...) at global/qlogging.cpp:1914
#9  QMessageLogger::fatal (this=<optimized out>, msg=<optimized out>) at global/qlogging.cpp:893
#10 0x00007f5daa393d89 in QtWaylandClient::QWaylandDisplay::checkError (this=<optimized out>) at qwaylanddisplay.cpp:209
#11 QtWaylandClient::QWaylandDisplay::checkError (this=<optimized out>) at qwaylanddisplay.cpp:204
#12 0x00007f5daa3a23ee in QtWaylandClient::QWaylandDisplay::flushRequests (this=0x55ecd3d8f110) at qwaylanddisplay.cpp:222
#13 0x00007f5dbbd172a0 in doActivate<false> (sender=0x55ecd3e004a0, signal_index=3, argv=0x7ffc6ff431b0) at kernel/qobject.cpp:3898
#14 0x00007f5dbbd1a486 in QSocketNotifier::activated (this=this@entry=0x55ecd3e004a0, _t1=..., _t2=<optimized out>, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
#15 0x00007f5dbbd1abf9 in QSocketNotifier::event (this=0x55ecd3e004a0, e=0x7ffc6ff432d0) at kernel/qsocketnotifier.cpp:302
#16 0x00007f5dbc8aa15f in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x55ecd3e004a0, e=0x7ffc6ff432d0) at kernel/qapplication.cpp:3630
#17 0x00007f5dbbce8bf8 in QCoreApplication::notifyInternal2 (receiver=0x55ecd3e004a0, event=0x7ffc6ff432d0) at kernel/qcoreapplication.cpp:1063
#18 0x00007f5dbbd3444f in socketNotifierSourceDispatch (source=source@entry=0x55ecd3dc17a0) at kernel/qeventdispatcher_glib.cpp:107
#19 0x00007f5dba28dfd7 in g_main_dispatch (context=0x55ecd3de53f0) at ../glib/gmain.c:3325
#20 g_main_context_dispatch (context=0x55ecd3de53f0) at ../glib/gmain.c:4016
#21 0x00007f5dba2ded88 in g_main_context_iterate.constprop.0 (context=context@entry=0x55ecd3de53f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4092
#22 0x00007f5dba28b41f in g_main_context_iteration (context=0x55ecd3de53f0, may_block=1) at ../glib/gmain.c:4157
#23 0x00007f5dbbd33a2f in QEventDispatcherGlib::processEvents (this=0x55ecd3e00300, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#24 0x00007f5dbbce765b in QEventLoop::exec (this=0x7ffc6ff434e0, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#25 0x00007f5dbbcef020 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#26 0x000055ecd34c87ca in main (argc=<optimized out>, argv=0x7ffc6ff43700) at /usr/src/debug/plasma-workspace-5.20.3-2.fc33.x86_64/shell/main.cpp:252
[Inferior 1 (process 3005) detached]
Comment 9 Germano Massullo 2020-11-13 11:49:31 UTC
Setting status back to reported
Comment 10 Germano Massullo 2020-11-13 11:51:45 UTC
(In reply to Germano Massullo from comment #8)
> [...] (new Plasma version, see details below) [...]

I am sorry I have forgotten to add Plasma KDE version
plasma-desktop-5.20.3-1.fc33.x86_64
KDE Frameworks 5.75.0
Qt 5.15.1 (compilato con 5.15.1)
Il sistema di finestre wayland
Comment 11 David Edmundson 2022-01-14 16:04:42 UTC
*** Bug 441213 has been marked as a duplicate of this bug. ***
Comment 12 Jiri Slaby 2022-01-15 08:01:36 UTC
(In reply to David Edmundson from comment #11)
> *** Bug 441213 has been marked as a duplicate of this bug. ***

FTR I'd say it's gone now. I didn't have to kill plasma for at least a month (I don't even remember when I had to last time).
Comment 13 Jiri Slaby 2022-01-15 08:02:28 UTC
(In reply to Jiri Slaby from comment #12)
> (In reply to David Edmundson from comment #11)
> > *** Bug 441213 has been marked as a duplicate of this bug. ***
> 
> FTR I'd say it's gone now. I didn't have to kill plasma for at least a month
> (I don't even remember when I had to last time).

plasma5-session-5.23.4-1.4.noarch I have.
Comment 14 Nate Graham 2022-01-15 22:28:12 UTC
Germano, can you confirm that?
Comment 15 Germano Massullo 2022-01-17 08:21:13 UTC
(In reply to Nate Graham from comment #14)
> Germano, can you confirm that?

Today I will try to switch back to Wayland session and check if this bug still happens. It will require some days of testing
Comment 16 Bug Janitor Service 2022-02-01 04:37: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 17 Germano Massullo 2022-02-01 07:36:46 UTC
Confirmed on 5.22.5-1.fc35 on XORG session (so it seems to not always be related to Wayland session)
Comment 18 322997am 2022-02-14 16:58:10 UTC
I have seen this on 5.24 as well. I have a core dump file I can upload, but it is huge. Are there any file hosts you prefer?
Comment 19 Matt 2022-03-29 05:51:05 UTC
Seeing this on 5.24.3 on Fedora. Plasmashell was just using 10GB of memory, restarting fixed it. Didn't have time to get a dump at the moment but if it happens again I'll provide more info.
Comment 20 mazzasantino1206 2022-03-29 19:28:54 UTC
It just happened to me too. I can't provide more details because it just happened spontaneously and I couldn't collect too much info.

I was doing stuff with goverlay and I just openned htop and saw that plasmashell was consuming 8GB increasing more and more.

Operating System: Fedora Linux 35
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.14.10-300.fc35.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i3-6100 CPU @ 3.70GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530
Comment 21 vindicator 2022-03-31 10:44:25 UTC
I am also getting this issue.
I switched from x11 a few days ago and was pleased at first that it was now function (the dealbreaker-bugs I mentioned before were no longer an issue).
I was noticing some severe memory pressure on my poor little 8GB system, but when looking at the reserved memory in htop, nothing was standing out.
For the leak in x11, I set the systemd service for plasmashell to kill itself after a threshold was reached. This was the reason I gave wayland another try.
But now it's here as well (in wayland) and even worse because I can't figure out where the memory is actually going.
Before plasmashell restarted, I had ~500MB left, and after ~2GB. That kind of discrepancy was not showing in htop. Plasmashell basically holding at ~350MB.
I took a look at df for /tmp which uses memory and that was normal (~2%).
I also took a look at /proc/meminfo since there was a bug long in the past that was related to SUnreclaim I think, and that also didn't appear to be an issue.

So I don't know if anyone has any other suggestions that I may be missing where memory could possibly be disappearing from and how I can find it.
Comment 22 vindicator 2022-03-31 13:31:33 UTC
I guess "correction" for my last reply...
I guess it wasn't killed because of memory, because it just happened again and the log showed:
*****
Mar 31 08:24:09 computerName systemd[5495]: Stopped KDE Plasma Workspace.
░░ Subject: A stop job for unit UNIT has finished
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit UNIT has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Mar 31 08:24:08 computerName kded5[6291]: Service  "org.kde.StatusNotifierHost-511032" unregistered
Mar 31 08:24:08 computerName plasmashell[511032]: The Wayland connection experienced a fatal error: Protocol error
Mar 31 08:24:08 computerName plasmashell[511032]: The Wayland connection experienced a fatal error: Protocol error
Mar 31 08:24:08 computerName plasmashell[511032]: xdg_wm_base@38: error 3: xdg_surface must not have a buffer at creation
Mar 31 08:24:08 computerName kwin_wayland[6261]: QMetaProperty::read: Unable to handle unregistered datatype 'KWin::SessionState' for property 'KWin::EffectsHandlerImpl::sessionState'
Mar 31 08:24:08 computerName kwin_wayland_wrapper[6261]: error in client communication (pid 511032)
Mar 31 08:23:48 computerName kwin_wayland[6261]: This plugin does not support raise()
*****
Comment 23 vindicator 2022-04-01 14:03:05 UTC
Another correction I guess...
Now it's looking like it wasn't plasmashell/wayland. It seems to be visual studio code using the omnisharp extension.
Again, the high memory usage just wasn't showing up in htop, so I have to hunt down where it's all going.
I had ~600MB left, and after closing it, I has ~1800MB. In htop, that should've shown at the top for sorted memory, and it wasn't.
Comment 24 vindicator 2022-04-03 20:02:45 UTC
One more correction (I hope), it wasn't vscode, but rather a hidden issue (much like the "SUnreclaim" from long ago)...
https://www.reddit.com/r/archlinux/comments/tv9d8j/memory_available_unaccounted_for/
The short of that is "Unevictable" memory climbed (3GB) and wasn't showing associated with any process.
When I came across a post about Intel's IGP leak(?), I remembered that issue was brought up regarding "notifications".
I restarted the plasmashell service, and Unevictable dropped to 1GB (still way too high, given only konsole was open).
I have yet to find out how to associate Unevictable memory with the related process(es), so I would know which one needs to be addressed accordingly.
Comment 25 Gabor Szita 2023-02-01 20:39:28 UTC
I'm having the same issue. I just came to realize that it's with wayland as it started appearing when I switched to wayland from X11. This has become almost a daily problem for me that I have to force-shut-down my computer and reboot it because it just freezes. The mouse starts lagging more and more and after about 20 seconds my whole computer just freezes.

It usually happens to me when I'm using chrome, vs code, and I'm switching fast through tabs, windows, and open files. Since chrome and vs code are both based on the chromium engine, wouldn't this suggest a problem with the integration between the chromium engine and wayland?

I'm on Arch Linux.
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7
Kernel version: 6.1.1-arch1-1 (64-bit)
Graphics Platform: Wayland

CPU: Intel Core i5-6300U @ 2.40 GHz
Memory: 15.5 GiB
Product: PORTEGE Z30t-C
Comment 26 Germano Massullo 2024-06-27 09:17:15 UTC
I am no longer experiencing this in Plasma 6
Comment 27 Jasmin 2024-06-27 09:18:31 UTC
(In reply to Germano Massullo from comment #26)
> I am no longer experiencing this in Plasma 6

I do with Wayland and 6.1.1
Comment 28 Nate Graham 2024-06-27 16:58:43 UTC
People's memory leaks are generalle all different. Since Germano's is fixed now, if you're still seeing it in Plasma 6, please open a new bug report for it so we can debug it alone. Thanks!