Bug 414785 - Notifications cause lag/freeze in plasmashell and apps when using an NVIDIA GPU
Summary: Notifications cause lag/freeze in plasmashell and apps when using an NVIDIA GPU
Status: RESOLVED UPSTREAM
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 5.22.3
Platform: Other Linux
: HI normal
Target Milestone: 1.0
Assignee: Kai Uwe Broulik
URL:
Keywords: efficiency
: 422310 438112 439361 443696 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-12-03 08:41 UTC by Janek Bevendorff
Modified: 2023-05-21 20:08 UTC (History)
16 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janek Bevendorff 2019-12-03 08:41:29 UTC
SUMMARY

Whenever a notification appears, my system starts lagging, including a sudden break in audio playback. Also, when I am copying files or downloading something in Chrome (with Plasma integration add-on), desktop effects show noticeable delay while the operation is running. For example, switching virtual desktops feels very sluggish, whereas without a progress notification going, it's fast and snappy. This happens even when the copy/download status notification popup isn't visible. As long as there is a hidden notification tracking the progress of an operation, the system is laggy.


STEPS TO REPRODUCE
1. Play some music
2. Trigger a notification

Alternatively:
1. Download a large file
2. Switch between desktops


OBSERVED RESULT
Audio stutter and effect delays.


EXPECTED RESULT
None of that.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 19.10
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64
Qt Version: 5.12
GPU: Nvidia GTX 1080 Ti with 435.21 proprietary driver
CPU: AMD Ryzen Threadripper 2920X
Comment 1 Lapineige 2020-12-10 12:07:12 UTC
Same issue here, seems to be related to an update to 5.19 as other people reported (while other don't): https://old.reddit.com/r/kde/comments/h0u6j7/choppy_nvidia_x11_performance_on_plasma_519_with/

Any notification that pop-ups slow down everything, kind of freezes display for a few seconds, then it's laggy (but displays the notification) then goes back to normal when the notification disappears.
I noticed a very high CPU usage for Xorg process during the whole slowdown. First it seems to go up to 100% of a single core (but screen is frozen, so I can't tell), then 85%, ~56% and then goes back to the normal 10~15% and display is smooth as usual.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 20.04
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74
Qt Version: 5.14.2
GPU: Nvidia GTX 1660 Super with 440.95.01 proprietary driver
CPU: AMD Ryzen 3600
Comment 2 Lapineige 2020-12-10 14:17:20 UTC
Update: I did enable triple buffering, following the instructions in the reddit topic linked above. It solved the issue for me.
Comment 3 Kai Uwe Broulik 2021-01-03 17:34:12 UTC
*** Bug 422310 has been marked as a duplicate of this bug. ***
Comment 4 Lapineige 2021-05-11 22:23:00 UTC
I have this issue again for a few days.
KDE : 5.19.5.
Nvidia drivers : 450.119.03.


I did not have the changes in usr/share/X11/xorg.conf.d/10-nvidia.conf adviced in the reddit topic.  I don't know if it was intentional (not done last time), something I forgot, and some file overwritten by a driver update or so.
I did them. Let's hope this will solve the issue.
Comment 5 Lapineige 2021-05-21 14:29:56 UTC
I did make that change, I still have the issue.
Comment 6 Samuel 2021-06-14 15:21:45 UTC
Look at the last comment from Plagman (Steam Proton Dev) on stuttering issue with steam notifications:-
https://github.com/ValveSoftware/steam-for-linux/issues/3429
I think this is the issue. I get a huge lag when there are loads of notifications and in single notification popup, I get some milliseconds of stutter and returns to normal, repeating the same when the notification fades away. I dont think that NVIDIA bug mentioned in his comment affects only steam but steam stutters the most while opening apps, showing notifications and stuff gets hit with stutter too whenever they appear.
Comment 7 Toby Fox 2021-06-14 19:10:52 UTC
I'm having the same issue but with slight variation, not sure if the exact same bug:

- Entire UI (kwin? plasma?) freezes for anywhere from 100ms to 1000ms whenever any notification appears
- Audio does *not* freeze. Mouse cursor also doesn't freeze, still moves smoothly
- I have a dual integrated Intel GPU + NVIDIA GPU (using bbswitch) and my NVIDIA GPU is switched off, so the issue isn't unique to NVIDIA drivers

I can reproduce as follows:

1. Open konsole and fill it with enough content such that you can scroll
2. While scrolling up and down with mouse/trackpad, run `notify-send foo`
3. Scrolling freezes for half second when notification appears

I tried both triple-buffering and the usleep environment variables for kwin, but no dice. Also tried setting "force lowest latency" in compositor settings, didn't seem to make a difference.

Overlays from changing monitor brightness and volume cause the same stutter. It happens only when the overlay first appears: once it's visible I can continue changing the volume without further stutter, and notifications/overlays disappearing do not cause stutter.

OS: Arch Linux x86_64 
Kernel: 5.12.9-arch1-1 
CPU: Intel i5-6300HQ (4) @ 3.200GHz 
GPU: Intel HD Graphics 530
GPU: NVIDIA GeForce GTX 960M (disabled)
KDE Plasma/KWin: 5.22.0
KDE Frameworks: 5.82.0
Qt: 5.15.2
Comment 8 Samuel 2021-06-28 19:54:24 UTC
Yep Overlays cause stutter too. Clearly evident in games. Whenever there is any notification pop-up or any overlay pop-up, the game frametime graph shows a spike (MangoHud). But when the notification is silent (dnd), there is no such stutter/spike in frametime.
Comment 9 Lapineige 2021-07-03 07:37:13 UTC
I did not notice any issue with the overlays (like volume control).
For my part it's only with the notifications.
Comment 10 Nate Graham 2021-07-06 14:32:46 UTC
*** Bug 436240 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2021-07-06 14:33:09 UTC

*** This bug has been marked as a duplicate of bug 438112 ***
Comment 12 Nate Graham 2021-07-06 14:33:48 UTC
*** Bug 438112 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2021-07-06 14:34:46 UTC
I can confirm this when an app sends a gazillion notifications. It happens less often now (see Bug 416807), but when it does, the system still becomes laggy.
Comment 14 Samuel 2021-07-06 14:44:53 UTC
https://github.com/ValveSoftware/steam-for-linux/issues/3429#issuecomment-54098190
Do you think this causes the issue? @Nate Graham?
Comment 15 Lapineige 2021-07-06 16:45:32 UTC
(In reply to Nate Graham from comment #13)
> I can confirm this when an app sends a gazillion notifications. It happens
> less often now (see Bug 416807), but when it does, the system still becomes
> laggy.

For my part I have this for every single notification, and I did not notice any difference no matter the number of them.
Comment 16 Samuel 2021-07-06 17:18:23 UTC
(In reply to Lapineige from comment #15)
> For my part I have this for every single notification, and I did not notice
> any difference no matter the number of them.

Yeah I too get stutter spikes whenever I receive a notification (multiple notification pop-ups at same time causes worse stutter than a single notification pop-up) or drag a window to the top for tiling it full screen (only stutters for the first time and only if done by dragging the window with mouse) and overlays like when increasing, decreasing or muting audio and while opening applications.
Comment 17 Nate Graham 2021-07-06 17:20:09 UTC
(In reply to sampingu02 from comment #14)
> https://github.com/ValveSoftware/steam-for-linux/issues/3429#issuecomment-
> 54098190
> Do you think this causes the issue? @Nate Graham?
I doubt it; the bug report is about the steam overlay, not Plasma notifications. And it seems to be related to some issue in the Nvidia driver, whereas this issue happens to users of non-Nvidia GPUs as well..
Comment 18 Samuel 2021-07-06 17:32:10 UTC
I commented that link in this bug report because the reporter Janek Bevendorff, Lapineige, Toby Fox and myself all have NVIDIA GPUs and we all have stutters when every single notification pop-up appears (which I guess isnt a problem in AMD or Intel GPUs because I tested it with Intel iGPU). In that link the Valve dev says that whenever X is manipulated in a way it causes hitch in OpenGL compositing. So  according to what he says it not only affects steam notifications but the entire OpenGL compositing whenever X is manipulated in a certain way(??) I am currently in GNOME and GNOME has some stutters too when notifications appear or when opening applications.
Comment 19 Nate Graham 2021-07-06 17:41:38 UTC
Hmm, perhaps there are multiple issues, then. Because I have an Intel iGPU and I can reproduce CPU spikes and lag when I get a lot of notifications, nut if you're experiencing an instant freeze when only a single notification appears, I think that's something else. Let's use this one to track the NVIDIA freeze/stutter.
Comment 20 Lapineige 2021-07-06 17:43:52 UTC
> or drag a window to the top for tiling it full screen (only stutters for the first time and only if done by dragging the window with mouse)

Very good catch, same here.
Comment 21 Lapineige 2021-07-06 17:47:48 UTC
I believe I need to add an additional information about my situation:
- The first time I encountered this issue, it was on my laptop (Nvidia GPU too, not the same one, not the same driver version, and Optimus/Prime enabled). It was fixed since that moment.
- I then transferred all my kde settings to a new PC, that I am using right now, and which is the one where I have the issue. It wasn't the case at the beginning, it appeared a while before my reply above to "reopen" the issue.
- I don't have the issue on the laptop.

If you need to test something in 2 "parent" systems, which both had the issue but one no longer encounters it, feel free to ping me.
Comment 22 Ilya Bizyaev 2021-07-06 19:04:41 UTC
I don't have an Nvidia GPU, and yet my bug was closed as a duplicate of this one. Should I reopen the original report or modify the name here?
Comment 23 Nate Graham 2021-07-06 22:33:00 UTC
Are you seeing the same freeze/hang/lag after a single notification appears that the NVIDIA users are? If so, modify the name of this bug report to indicate that it's not NVIDIA-specific. If not, un-dupe and put your bug in the "See Also" field of this one.
Comment 24 Matty R 2021-07-09 09:04:13 UTC
I'm having this as well - have done for as long as I can remember. What can we do to provide useful debug information?
Comment 25 Alexander M. 2021-07-12 10:57:29 UTC
Author of bug 438112 here, and after a very long while the bug hit me again:

Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: possible QQuickItem::polish() loop
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: ListView called polish() inside updatePolish() of ColumnLayout
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: possible QQuickItem::polish() loop
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: ColumnLayout called polish() inside updatePolish() of ListView
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: possible QQuickItem::polish() loop
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: ListView called polish() inside updatePolish() of ColumnLayout
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: possible QQuickItem::polish() loop
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: ColumnLayout called polish() inside updatePolish() of ListView
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: possible QQuickItem::polish() loop
Jul 12 13:52:25 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: ListView called polish() inside updatePolish() of ColumnLayout
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: possible QQuickItem::polish() loop
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: ListView called polish() inside updatePolish() of ColumnLayout
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: possible QQuickItem::polish() loop
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: ColumnLayout called polish() inside updatePolish() of ListView
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: possible QQuickItem::polish() loop
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: ListView called polish() inside updatePolish() of ColumnLayout
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: possible QQuickItem::polish() loop
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: ColumnLayout called polish() inside updatePolish() of ListView
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:416:29: QML ColumnLayout: possible QQuickItem::polish() loop
Jul 12 13:53:15 ArchBox plasmashell[1219]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml:258:13: QML ListView: ListView called polish() inside updatePolish() of ColumnLayout

I do have an Nvidia GPU but I have no issues with tiling or stuttering or whatever else, just with the notification applet freezing the plasma shell.
Comment 26 Nate Graham 2021-07-29 19:14:27 UTC
*** Bug 439361 has been marked as a duplicate of this bug. ***
Comment 27 Nate Graham 2021-09-14 20:21:32 UTC
This seems to be an issue with the NVIDIA driver; see https://bugs.kde.org/show_bug.cgi?id=439393#c11

I guess you can report this issue to the NVIDIA folks, either by sending an email to linux-bugs@nvidia.com or making a post at https://forums.developer.nvidia.com/c/gpu-unix-graphics/linux/

It would be helpful to the NVIDIA developers if you could run nvidia-bug-report.sh and attach the resulting file in your report. Thanks!
Comment 28 Nate Graham 2021-10-14 23:24:05 UTC
*** Bug 443696 has been marked as a duplicate of this bug. ***
Comment 29 Carlo Meijer 2022-01-23 17:36:31 UTC
I managed to work around the problem by means of the solution proposed here, number 2 (Disabling KWIN Vsync and force full composition pipeline): https://www.reddit.com/r/EndeavourOS/comments/p8b2kf/for_those_that_have_stutterlags_problems_with_kde/
I already reported it in the relevant nvidia forums topic, but I'm also posting it here since disabling vsync in KWin and forcing it to be offloaded to the nvidia driver seems to fix the issue. Perhaps there's something unforeseen going on in KWin and something can be done in KWin to fix/workaround the issue (perhaps some nvidia-specific hacks).

I found that latte-dock still stutters, disabling tooltips solved that one for me. I was hoping this magically solved it as well, but apparently not.
Comment 30 Lapineige 2022-01-23 18:35:34 UTC
> I already reported it in the relevant nvidia forums topic

Can you post the link here please ?
Comment 31 Carlo Meijer 2022-01-23 20:18:37 UTC
(In reply to Lapineige from comment #30)
> > I already reported it in the relevant nvidia forums topic
> 
> Can you post the link here please ?

Sure, https://forums.developer.nvidia.com/t/desktop-notifications-cause-stutter-on-kde-plasma-5-21-5/177717/8
I thought the topic was created by TS, but I'll post the link anyways.
Comment 32 Michael Hamilton 2022-01-23 20:32:26 UTC
(In reply to Carlo Meijer from comment #29)
> I managed to work around the problem by means of the solution proposed here,
> number 2 (Disabling KWIN Vsync and force full composition pipeline):
> https://www.reddit.com/r/EndeavourOS/comments/p8b2kf/
> for_those_that_have_stutterlags_problems_with_kde/
> I already reported it in the relevant nvidia forums topic, but I'm also
> posting it here since disabling vsync in KWin and forcing it to be offloaded
> to the nvidia driver seems to fix the issue. Perhaps there's something
> unforeseen going on in KWin and something can be done in KWin to
> fix/workaround the issue (perhaps some nvidia-specific hacks).
> 
> I found that latte-dock still stutters, disabling tooltips solved that one
> for me. I was hoping this magically solved it as well, but apparently not.

I tried the described work around. it doesn't appear to fix the stutter described in bug 443696 (a duplicate of this one), the test being: 

     for i in 1 2 3 4 5 6 7 8 9 10; do notify-send --expire-time 20000 test $i; done

Perhaps bug 443696 is not actually the same as this one.
Comment 33 Carlo Meijer 2022-01-23 20:42:15 UTC
(In reply to Michael Hamilton from comment #32)
> (In reply to Carlo Meijer from comment #29)
> > I managed to work around the problem by means of the solution proposed here,
> > number 2 (Disabling KWIN Vsync and force full composition pipeline):
> > https://www.reddit.com/r/EndeavourOS/comments/p8b2kf/
> > for_those_that_have_stutterlags_problems_with_kde/
> > I already reported it in the relevant nvidia forums topic, but I'm also
> > posting it here since disabling vsync in KWin and forcing it to be offloaded
> > to the nvidia driver seems to fix the issue. Perhaps there's something
> > unforeseen going on in KWin and something can be done in KWin to
> > fix/workaround the issue (perhaps some nvidia-specific hacks).
> > 
> > I found that latte-dock still stutters, disabling tooltips solved that one
> > for me. I was hoping this magically solved it as well, but apparently not.
> 
> I tried the described work around. it doesn't appear to fix the stutter
> described in bug 443696 (a duplicate of this one), the test being: 
> 
>      for i in 1 2 3 4 5 6 7 8 9 10; do notify-send --expire-time 20000 test
> $i; done
> 
> Perhaps bug 443696 is not actually the same as this one.

It seems that, indeed, there are two distinct issues:
1) is the one described by TS; as long as the notification is open, everything stutters. I had this issue as well, and solved it by offloading vsync to the nvidia driver, as referenced in my previous post.
2) is described in 443696 and 436902; stutters and cpu spikes appear only during the appearance and disappearance of a notification.

Now that I pay attention to it, it seems that my system is also affected by (2). However, in my humble opinion, it's is much less severe than (1). I can live with it until wayland is ready for daily use. Hopefully that will magically make the issue go away.
Comment 34 Magne Djupvik 2023-05-20 15:21:13 UTC
I still have stutters when notifications pop up, very easily reproducible with e.g. Spotify changing track while playing certain games. I have a dual screen setup with the following system:

Operating System: openSUSE Tumbleweed 20230517
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Kernel Version: 6.3.2-1-default (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 31.2 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 960/PCIe/SSE2
Manufacturer: ASUS

I see this has been marked as resolved, but if that's true, what I'm experiencing must be another bug with similar symptoms. Not sure if I should file another one, but I don't want to add more duplicates if it's already tracked here or in some other report.
Comment 35 Michael Hamilton 2023-05-21 02:16:12 UTC
(In reply to Magne Djupvik from comment #34)
> I still have stutters when notifications pop up, very easily reproducible
> with e.g. Spotify changing track while playing certain games. I have a dual
> screen setup with the following system:
> 
> Operating System: openSUSE Tumbleweed 20230517
> KDE Plasma Version: 5.27.5
> KDE Frameworks Version: 5.106.0
> Qt Version: 5.15.9
> Kernel Version: 6.3.2-1-default (64-bit)
> Graphics Platform: X11
> Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
> Memory: 31.2 GiB of RAM
> Graphics Processor: NVIDIA GeForce GTX 960/PCIe/SSE2
> Manufacturer: ASUS
> 
> I see this has been marked as resolved, but if that's true, what I'm
> experiencing must be another bug with similar symptoms. Not sure if I should
> file another one, but I don't want to add more duplicates if it's already
> tracked here or in some other report.

I'm on Tumbleweed 20230518, Ryzen 5 5600, 32 GB, GTX 1650 Super, ASUS TUF GAMING B550-PLUS WIFI II.
My original complaint over this issue appears to be fixed.  However, I more recently experienced audio skips after switching Tumbleweed from Pulse to Pipewire.   The skips seemed to mainly occur when Jetbrains Pycharm IDE was busy but also from other activities.   I couldn't find a resolution.  I removed pipewire and moving back to pulse.  That cleared the issue or reduced it so that I no longer notice it.   Perhaps this is a Tumbleweed issue.  We both have ASUS motherboards, it could also be a sound driver issue.
Comment 36 Magne Djupvik 2023-05-21 15:18:08 UTC
(In reply to Michael Hamilton from comment #35)
> I'm on Tumbleweed 20230518, Ryzen 5 5600, 32 GB, GTX 1650 Super, ASUS TUF
> GAMING B550-PLUS WIFI II.
> My original complaint over this issue appears to be fixed.  However, I more
> recently experienced audio skips after switching Tumbleweed from Pulse to
> Pipewire.   The skips seemed to mainly occur when Jetbrains Pycharm IDE was
> busy but also from other activities.   I couldn't find a resolution.  I
> removed pipewire and moving back to pulse.  That cleared the issue or
> reduced it so that I no longer notice it.   Perhaps this is a Tumbleweed
> issue.  We both have ASUS motherboards, it could also be a sound driver
> issue.

I also experience audio skipping with CPU spikes, like whenever I start a game in Steam. This is probably not a driver issue since I use an external Focusrite USB soundcard. And since I use and like Pipewire's ability to also function for software needing low latency like music production software, going back to having to switch between PulseAudio and JACK would be a painful step back for me. However, this is probably a different issue than Plasma notifications causing visible stuttering, like I described in my first post, so I'd like to find a separate bug report for it. If you know of any, please let me know.
Comment 37 Lapineige 2023-05-21 20:08:19 UTC
This is not fully resolved for me, it seems it's still lagging a bit when a notification appears.