Bug 494160 - Open Folder... in vscode causes kdialog to leak memory rapidly on Wayland
Summary: Open Folder... in vscode causes kdialog to leak memory rapidly on Wayland
Status: CONFIRMED
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: Kubuntu Linux
: NOR grave
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
: 494566 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-10-05 08:39 UTC by cyberjiber
Modified: 2024-10-16 20:12 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot of high mem usage (246.81 KB, image/png)
2024-10-05 08:39 UTC, cyberjiber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cyberjiber 2024-10-05 08:39:56 UTC
Created attachment 174443 [details]
Screenshot of high mem usage

SUMMARY
Wayland-only issue.

Attempting to open a folder from vscode (File Menu -> Open Folder...) caused kdialog to leak memory extremely rapidly: on the order of 500Mbs every few seconds on my system.

I'm unsure if this is a vscode-only issue. It may be a wider issue that affects any xcb (xwayland) window that attempts to launch kdialog.

CAUTION: If you are attempting to reproduce this, PLEASE have a System Monitor open so that you can terminate kdialog quickly before your system becomes inoperable.

STEPS TO REPRODUCE
1. Login with Wayland Session
2. Launch VSCode
3. Open the File menu
4. Select "Open Folder..."

OBSERVED RESULT
kdialog leaks memory rapidly every few seconds, causing system instability and eventually inoperability.

EXPECTED RESULT
kdialog should not leak memory.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 24.04
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13
Kernel Version: 6.8.0-45-generic (64-bit)
Graphics Platform: offscreen
Processors: 16 × AMD Ryzen 7 PRO 6850H with Radeon Graphics
Memory: 14.9 GiB of RAM
Graphics Processor: AMD Radeon Graphics

ADDITIONAL INFORMATION
VSCode info:
Version: 1.94.0
Commit: d78a74bcdfad14d5d3b1b782f87255d802b57511
Date: 2024-10-02T13:08:12.626Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.8.0-45-generic snap
Comment 1 bodorappe 2024-10-10 09:15:57 UTC
Same happens with me too.

Kubuntu 24.04
Kernel 6.8.0-45-generic (64-bit)
KDE Plasma 5.27.11
KDE Framweorks 5.115.0
Qt 5.15.13
Graphics Platform: X11

8 x AMD Ryzen 5 PRO 2500U w Radeon Vega 8
6.6 GiB RAM

VS Code: 1.94.1 (e10f2369d0d9614a452462f2e01cdc4aa9486296)
Comment 2 elledriver713 2024-10-10 12:16:56 UTC
I have exactly the same issue. Attempt to open a folder in vs code doesn't open any folder but leads to infinite memory consumption of kdialog.
Ubuntu 24.04
KDE 5.27.11

Just have updated today and got this bug.
Comment 3 Nicolas Fella 2024-10-11 22:50:46 UTC
*** Bug 494566 has been marked as a duplicate of this bug. ***
Comment 4 Nicolas Fella 2024-10-11 22:56:05 UTC
Okay, the problem is this:

Opening the file picker in VS Code uses kdialog. Internally kdialog uses QMimeDatabase, which gets the information from shared-mime-info. Due to a somewhat recent change in shared-mime-info it can happen that code reading it runs into an infinite loop. This seems to be happening in particular since Kubuntu and Snap both ship a (different) version of shared-mime-info.

The QMimeDatabase issue was fixed in Qt6 with https://codereview.qt-project.org/c/qt/qtbase/+/518454, but Qt5 (which is used on Kubuntu 24.04) wasn't fixed.

See https://github.com/microsoft/vscode/issues/230679, https://github.com/microsoft/vscode/issues/230454, https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/258#note_2167707
Comment 5 cyberjiber 2024-10-12 04:52:02 UTC
Thanks Nicolas!

Any chance that fix is getting back ported to Qt 5?
Comment 6 elledriver713 2024-10-16 20:12:12 UTC
Any news? This is very serious bug, the system is not usable.
As mentioned above, this bug doesn't' appear in QT6. I tested it in Kubuntu 24.10, there is no such bug.

System specs where I encounter a bug:
Operating System: Kubuntu 24.04
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13
Kernel Version: 6.8.0-45-generic (64-bit)
Graphics Platform: X11
Processors: 16 × Intel® Xeon® CPU E5-2689 0 @ 2.60GHz
Memory: 15.5 ГиБ of RAM
Graphics Processor: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2