Bug 387128

Summary: Memory leak in plasmashell with persistent notifications
Product: [Plasma] plasmashell Reporter: neko259
Component: NotificationsAssignee: Kai Uwe Broulik <kde>
Status: RESOLVED DUPLICATE    
Severity: normal CC: ao, bugseforuns, cfeck, denis.kot, egorov_egor, erin-kde, kde, nate, ncoghlan, orivej, plasma-bugs, rdieter, tehnick-8, xmakerenx
Priority: NOR    
Version: 5.11.3   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description neko259 2017-11-19 19:51:07 UTC
I got plasmashell leaked to 16 GiB of memory, which made me reboot it. In the next 10 minutes, it got 2 more GiB and I started the investigation of the cause. I the meanwhile, I struggled with qbittorrent notification popping up constantly about a torrent error, and resolving it stopped the plasma memory leak. I assumed it has to do with the notification history, and tried to open it and see how many notifications has been saved (I assume there were hundreds or thousands of them) but this freezed the entire system so I had to kill the plasmashell process to resume using the DE.
If the notifications are really saved to memory, this should be fixed cause if using the native notification system for chats, error messages etc clutters the history quickly.
Comment 1 xmakerenx 2017-11-30 20:32:23 UTC
I also have the same issue happen to me (also using archlinux with version 5.11.4, qt 5.9.3) 
every time a notification  pops up plasmashell memory usage goes up bit but never goes down..
After some digging it seems this memory leak started with this commit which added the notifications history:
https://cgit.kde.org/plasma-workspace.git/commit/?id=28d86ab4356737260e054009795e595fbb069158 
It seems that in Notifications.qml the notificationsHistoryModel var has the notifications being added to it but either notificationsHistoryModel isn't getting cleared or it is but the memory isn't for some reason (maybe Qt is doing something weird ?)

Anyway hopes this info helps track the bug.
Comment 2 David Edmundson 2017-11-30 20:49:11 UTC
are you saying with that reverted you don't have a leak?
Comment 3 xmakerenx 2017-11-30 20:58:30 UTC
yes exactly, after I reverted I didn't have the leak moreover if I comment out the code inserting to notificationsHistoryModel the leak also disappears
Comment 4 Erin Yuki Schlarb 2017-12-02 12:56:58 UTC
I could easily reproduce this by running:

`for i in {1..1000}; do notify-send "Test Notification $i"; done`

in another shell. Each invocation of that command takes about 20 seconds to fully execute and increases Plasma memory usage by 1GiB on my system. Opening the notification panel becomes awefully slow after running this, but once it's open it's "fast enough" to use.

(David Edmundson asked me to triage this bug.)
Comment 5 Kai Uwe Broulik 2017-12-02 14:02:37 UTC
I'll have a look.
Comment 6 David Edmundson 2017-12-04 14:07:01 UTC
*** Bug 387341 has been marked as a duplicate of this bug. ***
Comment 7 Kai Uwe Broulik 2018-03-12 12:22:11 UTC

*** This bug has been marked as a duplicate of bug 389132 ***