Summary: | kwin_wayland leaking memory and using a lot of SYS CPU on an AMD+Nvidia multi-GPU setup, regardless of whether both GPUs are in use | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Bráulio Barros de Oliveira <brauliobo> |
Component: | wayland-generic | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | fdevrijer, john.kizer, kde, me, xaver.hugl, zabotinskis30 |
Priority: | NOR | ||
Version First Reported In: | 6.2.4 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
two screens on the bottom connected to Ryzen 9700x iGPU and the one above connected to NVIDIA 4060 ti
kwin_wayland memory leak The requested log |
Description
Bráulio Barros de Oliveira
2024-12-01 17:14:39 UTC
Created attachment 176268 [details]
two screens on the bottom connected to Ryzen 9700x iGPU and the one above connected to NVIDIA 4060 ti
Hi - does the issue occur for you only after you start putting windows on the screen connected to the Nvidia card, or does it start happening regardless of whether anything is actively using the Nvidia card? (I can't reproduce on a single-GPU setup, or on an AMD+Nvidia hybrid laptop with a single screen). (In reply to John Kizer from comment #2) > Hi - does the issue occur for you only after you start putting windows on > the screen connected to the Nvidia card, or does it start happening > regardless of whether anything is actively using the Nvidia card? (I can't > reproduce on a single-GPU setup, or on an AMD+Nvidia hybrid laptop with a > single screen). Hi, I'm not sure, as windows on the top are there from the beginning of the KDE launch. The NVIDIA screen on the top is the one less used though, and for this report I barely used it (In reply to Bráulio Barros de Oliveira from comment #3) > Hi, I'm not sure, as windows on the top are there from the beginning of the > KDE launch. The NVIDIA screen on the top is the one less used though, and > for this report I barely used it Sorry, I probably should have rephrased - does the issue with memory/CPU usage growing happen if nothing is connected to the Nvidia card at all? If yes, does it also happen if you boot using the Nouveau drivers instead of the Nvidia ones? (Trying to narrow down to what extent this is a general multi-GPU issue, vs. specifically an issue with Nvidia cards and/or drivers) Thanks! I am experiencing this issue on a laptop with AMD iGPU and NVIDIA dGPU. Kernel: linux-zen 6.12.3 KDE Plasma: 6.2.4 KDE Frameworks: 6.8.0 Qt: 6.8.1 Nvidia drivers: 565.77.1 kwin_wayland memory usage keeps increasing as I'm using my laptop normally: web browsing, youtube, etc. (it went from 1.6 to 1.9 GB while I was writing this comment, screenshot attached). But it is most pronounced when running video games with the NVIDIA GPU. Running a game even for a few minutes can add gigabytes to kwin_wayland memory usage. Continuing to play makes kwin_wayland consume increasingly more RAM until all available RAM is filled, crashing the game, or even the whole Plasma DE. This issue occurs both when using the laptop built-in display, and when using an external display. I am not experiencing this issue on my single-GPU desktop with the same versions of Plasma/Frameworks/NVIDIA drivers. So this seems to be a multi-GPU issue. Created attachment 176468 [details]
kwin_wayland memory leak
Thanks, it seems that it doesn't depend on there being more than one monitor, or on which GPU is actually in use. Can either of you confirm whether using the Nouveau drivers stops the leak? 🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME. For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging. Thank you for helping us make KDE software even better for everyone! Hi, I seem to be having this or a similar bug. Operating System: Fedora Linux 41 KDE Plasma Version: 6.2.4 KDE Frameworks Version: 6.8.0 Qt Version: 6.8.0 Kernel Version: 6.11.11-300.fc41.x86_64 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 6800H with Radeon Graphics Memory: 30.5 GiB of RAM Graphics Processor: AMD Radeon 680M Manufacturer: LENOVO Product Name: 82RG System Version: Legion 5 Pro 16ARH7H The laptop also has a DGPU: NVIDIA GeForce RTX 3060 Laptop GPU NVIDIA drivers: 565.77 The issue seems to present itself when plugging in a monitor into the DGPU while kwin is running. If the monitor is already plugged in while kwin is starting (either at system boot or by running kwin_wayland --replace), the issue is not present. A work around I have been using is unplugging the monitor, at which point the memory is still used, and then plugging the monitor back in, at that point the leaked memory is cleared up, and the memory use starts slowly building again. As you asked the others if using Nouveau stops the leak, I had tried to switch to Nouveau, which did indeed stop the memory leak. However that had issues of its own, one of which was Xwayland seeming to crash as well as firefox (which is runnning on wayland). And then kwin spamming this in the logs: kwin_xwl: Failed to create pipe to start Xwayland: Too many open files Using the NVIDIA drivers with the memory leak is preferrable with the work around. As far as I know this issue started after updating to NVIDIA 565.77 Please let me know if there is anything else I can do to help debug this issue. Thanks - one other request for now: while you're experiencing the error, could you collect any system journal messages you see with the identifier kwin_wayland or kwin_wayland wrapper, or that contain a reference to Nvidia in their contents? The command listed below should put that into a file: sudo journalctl --boot 0 --grep=nvidia >> nvidia-memory-leak-log.txt && sudo journalctl --boot 0 --identifier=kwin_wayland >> nvidia-memory-leak-log.txt && sudo journalctl --boot 0 --identifier=kwin_wayland_wrapper >> nvidia-memory-leak-log.txt Thanks! Created attachment 177087 [details]
The requested log
As requested.
One thing that stands out to me is the huge amount of "kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)" messages.
I have tried to reproduce this by letting the memory build up and then reconnecting the monitor, but that does not trigger those messages, instead it seems to log this when I reconnect the monitor:
Jan 03 14:41:11 <hostname> kwin_wayland[2445]: kwin_scene_opengl: 0x500: GL_INVALID_ENUM error generated. Invalid <face>.
Jan 03 14:41:11 <hostname> kwin_wayland[2445]: kwin_scene_opengl: Invalid framebuffer status: "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"
Jan 03 14:41:11 <hostname> kwin_wayland[2445]: kwin_scene_opengl: 0x502: GL_INVALID_OPERATION error generated. <image> and <target> are incompatible
Jan 03 14:41:11 <hostname> kwin_wayland[2445]: kwin_scene_opengl: Invalid framebuffer status: "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"
Jan 03 14:41:11 <hostname> kwin_wayland[2445]: kwin_wayland_drm: Failed to create framebuffer: Invalid argument
Jan 03 14:41:11 <hostname> kwin_wayland[2445]: kwin_wayland_drm: Failed to create framebuffer: Invalid argument
Thanks! I suspect the kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT) messages are not directly related to the memory leak based on https://bugs.kde.org/show_bug.cgi?id=490682#c8 , but I'll defer to folks with more graphics stack knowledge there. (In reply to John Kizer from comment #12) > Thanks! I suspect the kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in > glDrawBuffers(unsupported buffer GL_BACK_LEFT) messages are not directly > related to the memory leak based on > https://bugs.kde.org/show_bug.cgi?id=490682#c8 , but I'll defer to folks > with more graphics stack knowledge there. Hi. Any updates on this issue? This could be related to https://invent.kde.org/plasma/kwin/-/commit/da1bebbb4480cfc26467ad3b31737b0df044b551, is this still happening for you in 6.2.5? (In reply to Zamundaaa from comment #14) > This could be related to > https://invent.kde.org/plasma/kwin/-/commit/ > da1bebbb4480cfc26467ad3b31737b0df044b551, is this still happening for you in > 6.2.5? Unfortunately it seems that did not fix it. Please let me know if there is anything I can do. Current system info: Operating System: Fedora Linux 41 KDE Plasma Version: 6.2.5 KDE Frameworks Version: 6.10.0 Qt Version: 6.8.1 Kernel Version: 6.12.8-200.fc41.x86_64 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 6800H with Radeon Graphics Memory: 30,5 GiB of RAM Graphics Processor: AMD Radeon 680M Manufacturer: LENOVO Product Name: 82RG System Version: Legion 5 Pro 16ARH7H *** This bug has been marked as a duplicate of bug 496469 *** I also have problem with kwin_wayland memory leak. I also have dual graphics card though the external Nvidia one is not in use and relying only on the AMD builtin one. kwin start up taking tiny amount of memory and it build up over period of days. After finding the bug, I tried to speed it up by playing games like other posters suggested but that didn't work for me. What ended up working for me is opening KDE settings and constantly changing windows decorators at random. In few minutes I got kwin_wayland usage to increase from 390+ MB to 619 MB and when I didn't fast enough it rose to 700MB with maybe 10 random window decoration changes. OS: Gentoo Linux x86_64 Host: ROG Zephyrus G14 GA401QC_GA401QC (1.0) Kernel: Linux 6.12.21-gentoo Uptime: 5 hours, 2 mins Packages: 1485 (emerge), 58 (flatpak) Shell: bash 5.2.37 Display (LQ140M1JW49): 1920x1080 @ 144 Hz in 14" [Built-in] DE: KDE Plasma 6.2.5 WM: KWin (Wayland) WM Theme: plastik Theme: Breeze (Shamrock) [Qt], Breeze-Dark [GTK2], Breeze [GTK3/4] Icons: breeze-dark [Qt], breeze-dark [GTK2/3/4] Font: Noto Sans (10pt) [Qt], Noto Sans (10pt) [GTK2/3/4] Cursor: breeze (24px) Terminal: konsole 24.12.3 Terminal Font: Liberation Mono (14pt, Bold) CPU: AMD Ryzen 7 5800HS (16) @ 4.46 GHz GPU 1: NVIDIA GeForce RTX 3050 Mobile [Discrete] GPU 2: AMD Radeon Vega Series / Radeon Vega Mobile Series [Integrated] Memory: 4.14 GiB / 15.04 GiB (28%) Swap: Disabled Disk (/): 126.00 GiB / 191.19 GiB (66%) - ext4 Disk (/home): 139.23 GiB / 191.19 GiB (73%) - ext4 Disk (/home/ramast/Videos): 19.11 GiB / 191.57 GiB (10%) - ext4 Disk (/mnt/c): 82.10 GiB / 280.77 GiB (29%) - ext4 Local IP (wlp2s0): 192.168.8.229/24 Battery (ASUS Battery): 74% [AC Connected] Locale: en_GB.UTF-8 It may not come as a surprise but I'll say it anyway: `kwin_wayland --replace` (brought back kwin_wayland memory usage to around 338MB) What NVidia driver version are you using? (In reply to Zamundaaa from comment #19) > What NVidia driver version are you using? NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] (rev a1) (prog-if 00 [VGA controller]) However I want to stress that I am not "using" it and by that I mean there is no loaded kernel driver for NVIDIA (I blacklisted it) I also don't have dual displays. just a single laptop display. Happy to provide screen sharing session over google meet if that helps at all. 🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME. For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging. Thank you for helping us make KDE software even better for everyone! |