Just want to leave it somewhere, I've spent the whole night troubleshooting this.
"Enable memory monitoring" feature of Konsole actually sets it's own cgroup
memory.high
limit.
It could cause significant performance degradation of heavy processes started in terminal.
In my case - it caused VS Code freezes.
So, this Konsole setting actually does this:
QFile memHighFile(_createdAppCGroupPath + QDir::separator() + QStringLiteral("memory.high"));
memHighFile.write(QStringLiteral("%1M").arg(newMemHigh).toLocal8Bit());
If you start some fancy modern IDE from terminal, for example like I'm used to:
git clone git@github.com:xyz/foo_bar.git
cd foo_bar
code ./
It will run in the same cgroup together with Konsole (and with all other tabs).
My VS Code with all plugins uses about 1-1.4G RAM while browsing small projects.
So just after 1-2 seconds after start when plugins occupied all available memory UI just freezes. Not completely, but it became very-very sloooooow.
And processes started by plugins (/opt/visual-studio-code/code, cpptools, clang-tidy, gopls, ...) start generating a lot of small disk reads.
It happens because all those executables and dynamic libraries that VS Code and plugins pull into the memory does not fit the limit and Linux starts swapping pages with the code being executed.
Now the story
First I looked at htop
and iotop
- found a bunch of processes, that looked like vscode plugins, trashing my SSD.
I was shocked! Brand new SSD is dying! Or I occasionally installed some malware and now it stealing my (empty :)) bitcoin wallet! Or my OS goes crazy! Bug in Linux kernel! WTF is going on?!
The most mind-blowing thing I have found after series of experiments was that it worked fine if I start it from Applications menu, or with Alt+F2.
Just imagine - the same text editor :), when you start it by click on the icon in the Applications menu works fine, and if you start it with command line - it just completely refuses to work.
First I expected different versions. I'm newbie in Manjaro, so maybe I have installed two different versions somehow. ps
, which
, locate
and pacman
showed it was the same application from a single package.
So my next guess was env vars. I was looking for some differences in the environment variables.
No results naturally.
Then tried to disable all plugins.
Of course it started working smoothly :) Of course! So I started enabling and disabling different plugins trying to find the one broken that eats my SSD.
At this point I could get even more confused. Because it obviously affects the behavior, but that is not a root cause.
By this time I already understood that actually heavy IO load must not affect UI, must not cause freezes.
And also I noticed that terminal application where I start the code from also became irresponsible. So I had to switch between Konsole and Yakuake starting vscode in one window and killing it in another one.
And after combining those two things:
- lots of small disk reads
- and freeze of the terminal application where I start the IDE
I finally recalled that yesterday I have, just in case, enabled this "memory monitoring" in Konsole.
Doublefacepalm.
I've learned something today. Again
- If you do not understand what those settings are really doing - be ready for magic things happening.
- In software sporadic issues are not sporadic. Mostly.
- You can handle any problem if apply enough patience and expertise.
Top comments (0)