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
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.
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.
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.
The data flow can be like: (When flood prevention is enabled) NotificationSortProxyModel -> QSortFilterProxyModel to filter out floods -> QConcatenateTablesProxyModel -> QAbstractListModel to track floods and create summary notifications -> Just need someone to implement the 3 models.