Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU usage after upgrading to version 1.54.1 in Ubuntu #118613

Closed
fperezgaliana opened this issue Mar 10, 2021 · 12 comments
Closed

High CPU usage after upgrading to version 1.54.1 in Ubuntu #118613

fperezgaliana opened this issue Mar 10, 2021 · 12 comments
Assignees
Labels
file-watcher File watcher freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster

Comments

@fperezgaliana
Copy link

fperezgaliana commented Mar 10, 2021

Issue Type: Performance Issue

After upgrading VS Code from version 1.53.2 to 1.54.1 in Ubuntu 20.10, I've realized that the laptop fans were working at full throttle. I ran "top" from the terminal and I saw that there was a "code" process taking more than 140% of the CPU (sometimes even more than 300%) and it stays like this indefinitely. The strange thing is that the process explorer from the help menu shows 0-1% CPU usage, so I'm a little bit lost with this. While it's fixed, I'll try to go back to the 1.53 version. Thanks.

VS Code version: Code 1.54.1 (f30a9b7, 2021-03-04T22:38:50.094Z)
OS version: Linux x64 5.8.0-44-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 3407)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 4, 3, 2
Memory (System) 15.55GB (3.71GB free)
Process Argv --no-sandbox --unity-launch --crash-reporter-id c90c8fb9-0ac5-47e3-98b6-2d2954dd1c50
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
Process Info
CPU %	Mem MB	   PID	Process
    0	   143	 34461	code main
    0	    32	 34463	   zygote
    0	   111	 34492	     gpu-process
    0	    32	 34464	   zygote
    0	    80	 38576	     window (Notificador de problemas)
    0	    48	 34506	   utility
    2	   111	 34617	   shared-process
    0	    48	 34684	     ptyHost
    0	     0	 38040	       /bin/bash
    0	     0	 38212	         top
    0	     0	 38609	     /bin/sh -c /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	     0	 38610	       /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	   223	 37935	   window (package.json - fwcloud-api - Visual Studio Code)
    0	   207	 37964	     extensionHost
    0	    64	 38121	       /usr/share/code/code /usr/share/code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=37964
    0	    48	 38087	     searchService
Workspace Info
|  Window (package.json - fwcloud-api - Visual Studio Code)
|    Folder (fwcloud-api): 5670 files
|      File types: sh(722) js(588) json(417) map(411) ts(333) nsh(117) nlf(67)
|                  html(57) nsi(51) bmp(45)
|      Conf files: github-actions(1) launch.json(1) gulp.js(1) sln(1)
|                  package.json(1) tsconfig.json(1)
|      Launch Configs: node(4);
Extensions (23)
Extension Author (truncated) Version
vscode-sqlite ale 0.11.1
ng-template Ang 11.2.5
vscode-intelephense-client bme 1.6.3
vscode-tailwindcss bra 0.5.9
simple-react-snippets bur 1.2.3
laravel-blade cjh 1.1.2
vscode-mysql-client2 cwe 3.5.6
githistory don 0.6.15
es7-react-js-snippets dsz 3.1.0
prettier-vscode esb 5.9.2
vscode-jest-runner fir 0.4.31
fluent-icons mig 0.0.7
vscode-docker ms- 1.10.0
vscode-language-pack-es MS- 1.54.2
csharp ms- 1.23.9
python ms- 2021.2.636928669
jupyter ms- 2021.3.619093157
remote-containers ms- 0.163.2
vscode-js-profile-flame ms- 0.0.14
debugger-for-chrome msj 4.12.12
vetur oct 0.33.1
pdf tom 1.1.0
twig wha 1.0.2

(2 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvsdeb440:30248342
pythonvsded773:30248341
vstes516:30244333
pythonvspyt875:30259475
vspre833:30267464

This is my actual top output:

imagen

@deepak1556
Copy link
Collaborator

Can you provide the output of cat /proc/<PID>/cmdline where PID is the process that shows high cpu usage.

@deepak1556 deepak1556 added the info-needed Issue requires more information from poster label Mar 10, 2021
@fperezgaliana
Copy link
Author

Here it is:

felip@Felip-MSI:~$ cat /proc/645264/cmdline
/usr/share/code/code/usr/share/code/resources/app/out/bootstrap-fork--type=watcherService

@ailixter
Copy link

the same story for me.
windows 10, wsl, ubuntu-18.04

%CPU %MEM     TIME+ COMMAND
181.7  2.1  21:24.33 /home/aii/.vscode-server/bin/f30a9b73e8ffc278e71575118b6bf568f04587c8/node /home/aii/.vscode-server/bin/f30a9b73e8ffc278e71575118b6bf568f04587c8/out/bootstrap-fork --type=watcherService

needless to say it slows down dramatically all the things such as suggestions

@ailixter
Copy link

windows 10, wsl, ubuntu-18.04

the possible solution in my case is turning config setting remote.WSL.fileWatcher.polling to false (although this has its consequences explained in its description)

@deepak1556 deepak1556 removed the info-needed Issue requires more information from poster label Mar 11, 2021
@deepak1556 deepak1556 added the file-watcher File watcher label Mar 11, 2021
@deepak1556
Copy link
Collaborator

deepak1556 commented Mar 12, 2021

@bpasero the cpu usage comes from the watcher service, currently we don't have a way to debug the service similar to extension host or other child processes. I am adding it in #118771, we can collect relevant cpu profiles from the service after that.

@bpasero
Copy link
Member

bpasero commented Mar 12, 2021

@ailixter for WSL please file a separate issue

@deepak1556 isn't this a duplicate of #3998?

@fperezgaliana does it reproduce even when you open small folders? Are you opening local or remote folders?

@bpasero bpasero added freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster labels Mar 12, 2021
@fperezgaliana
Copy link
Author

@bpasero it only happens on relatively big projects (+5000 source files). I've opened an smaller application (200 files) and it works perfectly. I've tried opening a remote folder (via SSHFS) containing a Symfony application with ~1200 source files and also works fine.

@bpasero
Copy link
Member

bpasero commented Mar 12, 2021

@fperezgaliana does it help if you configure files.watcherExclude to exclude the large folders of a workspace?

@alimbada
Copy link

the same story for me.
windows 10, wsl, ubuntu-18.04

%CPU %MEM     TIME+ COMMAND
181.7  2.1  21:24.33 /home/aii/.vscode-server/bin/f30a9b73e8ffc278e71575118b6bf568f04587c8/node /home/aii/.vscode-server/bin/f30a9b73e8ffc278e71575118b6bf568f04587c8/out/bootstrap-fork --type=watcherService

needless to say it slows down dramatically all the things such as suggestions

I have the same issue with the same setup (Win 10 on WSL Ubuntu 18.04). The only workaround that has worked for me is the one suggested in #3998, setting "files.watcherExclude": { "**": true} though I don't know what the consequences of this are. Using any other patterns, e.g. for node_modules subfolders in the form of "**/node_modules/**": true results in no change.

@bpasero
Copy link
Member

bpasero commented Mar 15, 2021

@alimbada I have extracted your particular issue which is WSL+remote specific to #119001. The issue in #3998 is specific only for local environments and only on macOS/Linux.

@davidwin
Copy link

davidwin commented May 6, 2021

I'd like this issue to be reopened, because it is very much present still in 1.56.0, and not only in Remote WSL. In Remote SSH to a Linux host I get the same high CPU usage in the watcherService whenever I run a build in that workspace. Excluding files or whole directories with files.watcherExclude has no impact at all. I have run strace on the process, and I can see it reading furiously from the files that are updated. The trace also shows that there is no polling going on, and the process will be mostly idle after the build finishes.
So, there are at least two problems here: One is that the exclusion mechanism isn't working, and the other is that the CPU load is unreasonably high whenever files are modified, even if they are not open in any editor window. I have to "nice" the process in order not to throttle the build too badly, which shouldn't be necessary even without filtering out build directories.

@github-actions github-actions bot locked and limited conversation to collaborators May 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
file-watcher File watcher freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

7 participants
@alimbada @bpasero @deepak1556 @ailixter @davidwin @fperezgaliana and others