vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

the node program high memory usage with Remote wsl

Open linsmod opened this issue 4 years ago • 35 comments

Issue Type: Bug

when open chromium project in remote-wsl after a while , node program in .vscode-server eat memory up to more than 2G

Extension version: 0.44.2 VS Code version: Code 1.44.2 (ff915844119ce9485abfe8aa9076ec76b5300ddd, 2020-04-16T16:36:23.138Z) OS version: Windows_NT x64 10.0.18363 Remote OS version: Linux x64 4.4.0-18362-Microsoft

System Info
Item Value
CPUs AMD Ryzen 7 3700X 8-Core Processor (16 x 3600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.95GB (1.17GB free)
Process Argv D:\chromium\src
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-18.04
OS Linux x64 4.4.0-18362-Microsoft
CPUs AMD Ryzen 7 3700X 8-Core Processor (16 x 3600)
Memory (System) 15.95GB (1.17GB free)
VM 0%

image

linsmod avatar May 03 '20 01:05 linsmod

I have got the same issue.

Windows Pro x64 10.0.18363 WSL OS: Ubuntu 18.04 4.4.0-18362-Microsoft VS Code: 1.45.1 2b65f8a42198f5bc470b28a01fe84ec8788e6adc Extension version: 0.44.2

dichioniccolo avatar May 23 '20 18:05 dichioniccolo

Yes, me too! And I'm not running tasks that use a lot of memory or cpu

scodeler avatar Jun 16 '20 13:06 scodeler

My guess is that Remote WSL for vscode is causing the Linux kernel to cache a lot of files, and then hitting this issue https://github.com/microsoft/WSL/issues/4166

that said, while I see similar behavior on my end, the drop_cache workaround in there doesn't seem to help much. Only exiting vscode seems to make the RAM usage go back down.

FFdhorkin avatar Jun 24 '20 17:06 FFdhorkin

I have got the same issue.

Microsoft Windows [version 10.0.18362.900] WSL OS: Ubuntu 20.04 LTS VS Code: 1.46.1

image

sulletf avatar Jul 09 '20 15:07 sulletf

This is affecting me as well. I guess we should just upvote the OP's post to avoid "me too" comments. (I realise I'm doing the same 😅)

nikhilweee avatar Jul 13 '20 08:07 nikhilweee

Same here. Too much ram usage like 1161M from htop I can see for the node of vscode server in wsl 2 ubuntu 20.04.

souradeep100 avatar Jul 30 '20 17:07 souradeep100

Our problem does not seem to be very urgent to the community ... It's been months now since the first post. Anyone has any news ? Maybe should we post on stackoverflow instead, no ?

sulletf avatar Aug 25 '20 07:08 sulletf

Just adding to this that I'm having the same problem.

pablodavila95 avatar Sep 30 '20 02:09 pablodavila95

Development on WSL 2 is becoming more trouble than its worth because of this

ahwise avatar Oct 07 '20 11:10 ahwise

WSL 2 forces me to use wsl mode because hot reloading doesn't work in wsl 2 when the files are in the windows system. Then using vs code in wsl remote mode my memory usage is so high.

Still a problem

darylthornhill avatar Oct 07 '20 12:10 darylthornhill

I found that limiting WSL's RAM usage in .wslconfig helps. I'm assuming the issue isn't really solved but it can avoid RAM usage from ballooning. I have it limited to 1GB with no issues. If you are running a heavy project you could run into issues but I haven't experienced any.

pablodavila95 avatar Oct 07 '20 13:10 pablodavila95

I have configured .wslconfig to limit memory consumption and I utilize the drop_cache workaround. However, my memory will not be reclaimed without completely shutting down vscode. This is very annoying and makes it not worth developing on windows.

bvanhou avatar Nov 14 '20 21:11 bvanhou

I guess no updates on this ?

bogdan-calapod avatar Feb 01 '21 17:02 bogdan-calapod

The only way I have gotten around this is by limiting the amount of memory wsl uses.

It's not a direct fix but it does stop your wsl from hogging so much memory.

https://medium.com/@lewwybogus/how-to-stop-wsl2-from-hogging-all-your-ram-with-docker-d7846b9c5b37

darylthornhill avatar Feb 03 '21 10:02 darylthornhill

Updating on my previous comment, at some point the .wslconfig file is essentially ignored as VS Code simply takes all the RAM it wants. My guess is that this issue happens because of WSL rather than VS Code, but VSC still uses too much memory.

My current workaround is to work on my projects via Windows and running a WSL terminal to execute the projects for testing.

pablodavila95 avatar Feb 05 '21 01:02 pablodavila95

I found that limiting the available memory for WSL does not really help, because VS Code apparently still tries to allocate all memory and will get significantly slower after a while. Then the only remedy is restarting VS Code, which I had to do every hour or to be able to keep working.

Personally, I can not recommend using VS Code with WSL 2 as long as this major issue exists. Luckily, it is pretty easy to migrate back to WSL 1. Just run the following from an admin powershell:

wsl --set-version Ubuntu 1

ErikKalkoken avatar Feb 23 '21 10:02 ErikKalkoken

any update ? image

same problem running node process inside docker or wsl2. This is causing wsl crashes.

lucas-garrido avatar Jul 26 '21 08:07 lucas-garrido

Same problem here, I need to work with 4 VS Code connected on WSL 2 and it costs most part of my RAM.

image

Any updates?

lucca30 avatar Aug 18 '21 12:08 lucca30

Same problem here, after a while VS code uses a lot of RAM. VS code studio is not even running! I exited the program but this process is still running. Using WSL 1 image

Edit : I figured it was because I where using WSL and opened the root directory. I believe it was causing vscode to index all files on my computer thus quickly filling up ram. I solved it by opening a folder with less subfolders

ArtificialTruth avatar Sep 13 '21 14:09 ArtificialTruth

same here, getting vscode node.js process growing to 1.5 GB. I've limited wsl memory so it gets eventually killed by OOM killer, before that WSL is frozen for quite some time, vscode is to be reloaded etc etc. Please fix that bug already.

avk999 avatar Sep 22 '21 08:09 avk999

I may be talking crap, but it seems like VSCode always starts a new WSL instance instead of connecting to an already running one? My windows terminal is set to start a "ubuntu" (lowercase letters) instance, while VS Code seems to start another image (Ubuntu, capitalized): image

mbomfim33 avatar Oct 01 '21 15:10 mbomfim33

Running htop on WSL I can see it's my extensions installed locally on the WSL box that are killing my system. Disabling them it runs fine, I'm guessing some of the extensions I use aren't properly optimised to run on WSL.

danjdewhurst avatar Nov 23 '21 14:11 danjdewhurst

Any update on this?

danjdewhurst avatar Jan 25 '22 10:01 danjdewhurst

Same here! Any update on this?

danielrangelsa avatar Feb 22 '22 19:02 danielrangelsa

The only thing I've been doing is using the .wslconfig to limit ram and processors

Create one in C:\Users\<user>\.wslconfig

Here's my config below, but you can put this lower if you want less ram to be gobbled up by [wsl2] memory=6GB # Limits VM memory in WSL2 to 6 GB processors=6 # Makes the WSL2 VM use 6 virtual processors

darylthornhill avatar Feb 23 '22 10:02 darylthornhill

Hello, is there an update on this issue? I found that limiting the WSL memory is good for preventing the whole system from being unstable. However, I'm seeing myself restarting every few hours because WSL would still eventually run out of memory.

jsunico avatar Jun 08 '22 10:06 jsunico

image

cpu: intel n5105 os: pve 7.2 ct template ubuntu 2204

maicss avatar Sep 11 '22 16:09 maicss

VS Code remote with ssh is unusable if you use virtual machine as a development environment. Node instances can easily take 2 gigabytes of memory and CPU load is randomly spiking even in casual code and debug session. I think you should have option for ssh remote development without running VSC server for now.

jjarv-tuni avatar Nov 29 '22 08:11 jjarv-tuni

VS Code remote with ssh is unusable if you use virtual machine as a development environment. Node instances can easily take 2 gigabytes of memory and CPU load is randomly spiking even in casual code and debug session. I think you should have option for ssh remote development without running VSC server for now.

Even with the BareMetal development env, I'm also coming up with this issue. Sometimes it steadily eats the memory 20G+, even I've already disconnected and closed vscode in my laptop......

Any configuration could been tuned or workaround for this?

PlatformLC avatar Jan 18 '23 07:01 PlatformLC

Same here! Any update on this?

Kingking1994 avatar Mar 28 '23 11:03 Kingking1994