vscode-remote-release
vscode-remote-release copied to clipboard
High CPU usage by vscode-server/typescript
As top
reports, VSCode server is using more than 80% of the CPU on my devserver, leaving me with little CPU to run useful commands. It's a free tier t2.micro ec2, making this doubly bad as I'm long-term penalized for any usage over 20%.
The cmd for pids with highest CPU usage, 10553
and 10760
respectively, are reported by /proc/*/cmdline
as
/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node--max-old-space-size=3072/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/node_modules/typescript/lib/tsserver.js--useInferredProjectPerProjectRoot--enableTelemetry--cancellationPipeName/tmp/vscode-typescript1000/259048e745e4b6b760a9/tscancellation-389a5bb0a343f462a86f.tmp*--globalPluginstypescript-vscode-sh-plugin--pluginProbeLocations/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/typescript-language-features--localeen--noGetErrOnBackgroundUpdate--validateDefaultNpmLocation
and
/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/node_modules/typescript/lib/typingsInstaller.js--globalTypingsCacheLocation/home/ec2-user/.cache/typescript/3.9--enableTelemetry--typesMapLocation/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/node_modules/typescript/lib/typesMap.json--validateDefaultNpmLocation
These plugins are doing Typescript things. I'm working in JS, and would be fine with not having TS LSP enabled features.
In general, it would be great if vscode-server could cap the CPU usage of extension processes, such as putting them in a cgroup with cpu.weight/cpu.max.
/cc @mjbvz in case the tsserver has a way of limiting CPU usage.
Marking as feature request for the cgroup suggestion.
This extension caused a server crash this morning by utilizing 193% of the ec2 CPU, so this seems to still be an issue FYI
This is also an issue for me, and this post solved/explained it: https://medium.com/good-robot/use-visual-studio-code-remote-ssh-sftp-without-crashing-your-server-a1dc2ef0936d
However, disabling the extension disables it globally. I'd love to 1) have this not happen at all and/or 2) be able to disable the extension only for Remote SSH usage.
In my opinion this should be a bug. intelisense in VS Code remote is ultra slow, and it's caused by this extension somehow missbehaving. The moment I type something, I get CPU usage over 100 on the tsserver process:
/home/namir/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/node --max-old-space-size=3072 /home/namir/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /tmp/vscode-typescript1000/096c6cf00a06191a9c6a/tscancellation-16e5cf8fc136d39a8478.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation
I don't think this should be expected, because this renders using TS or JavaScript with nice intelisense (one of the main features of vscode) quite a pain.
It seems like, as of now, the only solution is disabling it and losing these nice features... :(
The ssh component in VSCode cause 130% CPU load on the server what is unaccessable because of this! +1
yes, this is a bug
@chrmarti @bamurtaugh 2 years later this issue is still occurring. Is there anything we can do to help get this resolved?
@DocterDum Which process do you see using too much CPU? Is your repository checked out on a Windows or macOS filesystem and mounted into the container? In that case: Does using F1
> Remote-Containers: Clone Repository in Container Volume...
result in better performance?
Hey @chrmarti,
Sorry for the delay, I had to move my workload to a different machine so I could test on this one without interruptions, and then had issues actually capturing what was using the CPU (Machine became inoperable at 100% CPU usage).
The offending process is vscode-server's Node. I am not working with a repository or containers, I'm using Remote - SSH.
I'm just posting a comment here to keep this thing going. Is this being looked at? I had an issue today with a development server that kept going down because /home/user/.vscode-server/bin/[...]/node
was using all the CPU. I have disabled Intelephense in my VS Code, that seems to have helped, but I want those features.
i am seeing the same thing. For me, I observe that these processes not only eat CPU, but a lot of RAM, which causes my EC2 dev instance to start thrashing SWAP when it runs out of RAM...which in the end forces me to reboot the entire instance because everything becomes virtually unresponsive.
https://github.com/microsoft/vscode-remote-release/issues/3319#issuecomment-1197693307 shows the html language server using a lot of CPU. Maybe this has been fixed since @aeschli?
@BrianPittVP @mhempel-unl Could you open new issues with the output from ps ax
in the remote included?
That's interesting. I wasn't aware of problems in the HTML language server. Do you have that reproducible? The HTML server only looks at a single HTML file (no following of references). If you find the file that triggers the load and could send me that file (or a similar one) then I can investigate.
Same problem. My RP4 is close to a heart attack.
Edit: I just figured out that this issue only exists if I open the root directory. /home and /opt are fine (15% CPU usage vs. 99%)
I have been experiencing the same issue in 2023 and i solved it by disabling Intelephense
Same issue here and I don't ever have Intelephense.
Just ran into this issue; had node at 300% cpu usage on our linux development server running intellephense and vs code server. We were having intermittent latency issues on that server for days and didn't know why. My boss is now not allowing me to use VS Code lol***
***half laughing half crying
we are in 2023 and after 2-3 years it's not solved?! what the hell vscode guys doing?
The problem still present.
The issue is still there. It killed the dev machine this morning. The solution I use normally is to connect separately from a terminal, delete the .vscode-server folder and connect again afterwards with VSCode.
I have disabled typescript & other things suggested by the community, but doesn`t solve anything.
It seems that the "node" processes don't kill themselves after disconnecting from the server either. That's what's killing it at least for me. There are constantly 2 of them running when that happens with over 50% CPU usage each.
If I catch it on time (before the machine entirely seizes up), I can typically run a "killall node" to get rid of all the node processes that the VSCode server spawns and recover the machine without reboot. It will make my SSH connection via VSCode disconnect and reconnect, but that's acceptable as long as I have everything saved. In rare cases, however, I am forced to restart the entire remote server (in my case via the AWS EC2 web console). My recommendation is to see if you can make the remote machine have more RAM (easy if it's a virtual instance, not so easy otherwise). This helps reduce the frequency with which this happens. From my observations, this occurs because the VSCode node processes consume all the available RAM after a while, and as a result, SWAP will be used after a certain point, which puts extreme load on the storage in your system, which is what is slowing everything down ultimately.
I had this when I opened remote root (server froze), and it was not a Typescript problem. Unsure if it was an extension problem or not, but I had very few extensions, mostly default ones.
I had same problem.
It helped me:
First
I thought that some extension in vscode may cause this problem, and I deleted several of the which I never used. Some ssh remote connection but not main that can connect vscode by ssh to my server. It decrease my cpu usage by 25%.
Second
I notice that vscode always tells me about - I can't read all files on server, so I thought that vscode trying to do that on a cycle and can't stop, just trying and trying.
So I did this:
https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
It helped me completely.
I have this problem as well. Seems like removing the root directory from explorer reduced the node command's CPU usage from 100% to <1%. Maybe the file scanning isn't a scalable feature?
The issue I'm facing is CPU spike when I open the GUI for vscode-remote (no code action taken), followed by server crash.
Issue still there!
I had the same issue just today! Solution for me was to uncheck the "search:follow symlinks" in preferences > settings