Visual Studio Code on KDE causes kdialog to allocate infinite memory until Linux freezes
Asked Answered
L

3

5

When trying to open the "Save As" dialog to save any file in Visual Studio Code on KDE (Ubuntu 24.04, the dialog does not open, and a separate process "kdialog" starts using 100% of CPU and tries to continuously allocating memory until it's full and the system completely freezes.

Steps to reproduce (including clearing data and reinstalling VS Code):

snap remove --purge code
rm -rf ~/.config/Code
rm -rf ~/.vscode
snap install code --classic

Open VS Code (even with all extensions disabled and GPU acceleration turned off). Create a new file and try to save it.

When trying to save the new file, VS Code starts an instance of kdialog with the following arguments:

kdialog --attach=75497476 --title="Save As" --getsavefilename /home/user/textfile "All Files (*.txt)|Plain Text (*.bat *.cmd) [...]"

This command if run separately runs properly, opens the dialog and returns in stdout the correct file path.

By trying to attach strace to the kdialog process (strace -f -p $(pgrep kdialog)) it shows an infinite call of brk kernel function, indicating it's indeed continuously trying to extend the memory dedicated to the process.

Further investigation attaching gdb to the kdialog process it looks like the process is stuck in an infinite loop inside KBuildSycoca::recreate. I'm not quite sure what "ksycoca" is doing, but it looks like its related to a file in ~/.cache/.ksyscoca5*, and indeed there is a .lock file referring to kdialog with the same process ID (PID). I even tried to clear those cache files but they gets recreated when kdialog is trying to start again.

Any idea on how to investigate further and how (and if) is this ksyscoca involved in all this?

(kdialog version 23.08.5, VS Code version 1.94.2 x64)

Labrador answered 15/10, 2024 at 9:41 Comment(0)
R
7

Same here (kdialog version 23.08.5, vscode version 1.94.2 x64)

The workaround mentioned here works for me: https://github.com/microsoft/vscode/issues/231310

File > Preferences > Settings > Text Editor > Files > Simple Dialog > Enable

Rafaelof answered 15/10, 2024 at 11:5 Comment(1)
Simplest solution and easily reversible once this bug is fixed. ThanksSzymanski
R
1

Another Workaround would be to update to Kubuntu 24.10 which uses Qt6 instead of Qt5 which seems to have recieved a fix for this issue. Unfortunately there is no backport fix for this in Qt5 (yet).

SOURCE

Rigi answered 28/10, 2024 at 16:1 Comment(0)
G
0

The same problem here. I don't know whether the following observation can be of any use. Only the updates of the last 2 weeks after fresh Kubuntu 24.04 LTS installation.

I encountered the problem with kdialog when I wanted to try out 2 python CAD modules. I installed cadquery and aspose-cad with an active virtual environment. Needless to say, I didn't spend much time with the docs and just wanted to run some hello-world code.

https://github.com/CadQuery/cadquery

pip install cadquery

https://pypi.org/project/aspose-cad/

pip install aspose-cad

I noticed during the installation outputs that a lot of Qt 5 stuff was installed, although I thought I had Qt6 on my system. Immediately after these unsuccessful installation attempts, I could no longer open the file/folder kdialog from within vscode. Complete vscode reinstallation did not change anything and since then I can only continue working with the Simple Dialog > Enable method.

system:
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-47-generic (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-4590 CPU @ 3.30GHz
Memory: 31,3 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 4600
Manufacturer: Dell Inc.
Product Name: OptiPlex 7020
System Version: 00

vscode:
Version: 1.94.2
Date: 2024-10-09T16:08:44.566Z
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-47-generic snap

kdialog 23.08.5
Gallivant answered 18/10, 2024 at 6:31 Comment(4)
What you say could suggest there might be version clashes between qt5 and qt6?Labrador
Yes, something in connection with KDE/ Qt got mixed up.Gallivant
This is confirmed hereRigi
I am experiencing this on Ubuntu 24.04 Gnome but I seem to have this issue opening any KDE QT app dialog (example kvantummanagers 'open file' button), and attempting to open Dolphin in general it just hung and started to fill up my system memory. I had to quickly find the process and kill it.Iyre

© 2022 - 2025 — McMap. All rights reserved.