Bug 441906

Summary: Reconnecting to internet after downtime triggers flood of notifications from apps that remained open during that time
Product: [Plasma] plasmashell Reporter: Marten <w-m>
Component: NotificationsAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: normal CC: agurenko, fanzhuyifan, kdelibs-bugs, nate, nicolas.fella, plasma-bugs, postix, raphael.kde, w-m
Priority: HI Keywords: usability
Version: master   
Target Milestone: 1.0   
Platform: Manjaro   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=440837
https://bugs.kde.org/show_bug.cgi?id=486070
Latest Commit: Version Fixed In:

Description Marten 2021-09-02 11:46:12 UTC
SUMMARY

When an application sends hundreds of notifications in short succession, the system may freeze (out of memory?). 
This is often caused by a reconnecting to the internet after e.g. having been on stand-by, and receiving notifications for each and every missed chat message at once.


STEPS TO REPRODUCE
1. Run a program which creates a notification on e.g. an incoming chat message (for instance, Telegram or Discord).
2. Go 'offline' for some time. I commonly trigger it because my computer was on  'stand by' for a couple of hours and then wakes up again.
3. On reconnecting to the internet, hundreds of messages appear in close succession.
4. The notification manager tries to create and display a notification window for all of these.

OBSERVED RESULT

In the best case, multiple minutes where the rightmost part of the screen is covered by a super high stack of notifications which are appearing and disappearing in rapid succession, often with a slowdown of the machine as a whole (as significant effort seems to be put in creating/animating all of these notifications).

In the worst case, the computer hangs with a frozen screen, requiring a hard-reset restart. My assumption is that this happens because so many notifications are created that the computer runs out of RAM.

EXPECTED RESULT
It is expected that all notifications will show up in the 'history' tab of the notification manager, but it does not make sense to pop-up all of them. Maybe a rate-limiting technique can be used to limit excessive notification requests. For instance, limit pop-up to a maximum of, five per application per second.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro 21.1.1
(available in About System)
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Comment 1 Nate Graham 2021-09-02 18:16:54 UTC
I am able to reproduce the frustrating flood of notifications in this case, but not any crashes or memory spikes because of it. Are you using an NVIDIA GPU? If so, you are probably experiencing Bug 414785 in addition to just the notification flood issue.

Regardless, probably what we should do us suppress any notifications that are not sent in real-time; e.g. queued-up notifications from apps that *would have sent* while the network was down or Do Not Disturb mode was active. See Bug 440837.
Comment 2 Raphaƫl Jakse 2022-04-24 07:41:52 UTC
What about grouping notifications?
If an application issues more than N notifications in a short time, display a (meta) notification saying "X notifications from this application", with the application and its icon in the notification title. A button "Show details" could open the notification drawer at the right place.

It is still useful to be notified that something happened when reconnecting, leaving suspend or DND I think.
Comment 3 Nate Graham 2024-04-24 13:05:16 UTC
In Plasma 6 I can now reproduce the performance issues resulting from the notification flood. Grouping them into one might make sense. We should also do some profiling to see why creating so many notifications causes performmance issues.