microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.87k stars 29.52k forks source link

VSCode’s renderer helper process using 100% of CPU #148226

Open chenbin3625 opened 2 years ago

chenbin3625 commented 2 years ago

Does this issue occur when all extensions are disabled?: Yes/No

image image

The vscode Code Helper (Renderer) process consumes a lot of cpu and causes a very high processor temperature, closing vscode and disabling all extensions will not solve the problem. After a clean reinstall the problem persisted. The way to reproduce is to open vscode and use the search function will appear, and vscode's own process manager does not show this abnormal process, you need to manually go to apple's process manager to end the task.

chenbin3625 commented 2 years ago
image

My Computer. MacBook Air 2020 M1 16G RAM + 512G ROM If there's any other information you need, I'd be happy to provide it.

Moshikot3 commented 2 years ago

Having the same issue on MacBook Pro 2020 M1 16GB RAM

it took 30% CPU for no reason while VS Code was closed.

Feel free to ask for information / logs if needed.

deepak1556 commented 2 years ago

Can you attach a process sample from the activity monitor of the Code Helper (Renderer) process that shows high cpu usage.

chenbin3625 commented 2 years ago

您能否从Code Helper (Renderer)显示高 cpu 使用率的进程的活动监视器中附加一个进程示例。 This process is not visible in vscode's process manager. And this process will not be closed after closing vscode. There is no way to know which task is the host of this process.

chenbin3625 commented 2 years ago

您可以从Code Helper (Renderer)高 cpu 使用率进程的活动中显示附加进程的一个示例。

The problem is also not that it takes up 100% of one core usage, but because this process causes the MacBook to heat up abnormally. Normally, the MacBook's cpu temperature is around 40 degrees Celsius, and once this abnormal process is in place, the MacBook's cpu temperature will soar to 80 degrees Celsius.

fanyang-mono commented 2 years ago

I also hit this issue on my MacBook Pro (15-inch, 2018) even after I exit VS Code completely.

richard-fairthorne commented 2 years ago

I have the same issue on a brand new M1 Mac with no other software installed after purchase. No source code has ever been opened. No extensions have been added. I had a similar issue on my 2012 MacBook Pro Retina, and purchased the M1 yesterday to make the issue tolerable.

Yesterday I purchased the machine, and installed VSCode. I opened it once to see that it operated, and then closed it. Not long after, I closed the machine.

This morning, I opened the machine. It got warm quickly, and these processes were hogging cores. NB, VSCode is NOT running, and no extensions have been added.

Rogue processes:

Screen Shot 2022-05-12 at 7 20 21 AM

Process information:

Screen Shot 2022-05-12 at 7 21 05 AM

Macbook information:

Screen Shot 2022-05-12 at 7 21 52 AM

Here is the VSCode version information:

Version: 1.67.1 (Universal)
Commit: da15b6fd3ef856477bf6f4fb29ba1b7af717770d
Date: 2022-05-06T12:37:16.526Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin arm64 21.3.0

Both my new and old MacBooks are always running hot due to these processes, which is more desirable during the winter, but it's May 🤣

richard-fairthorne commented 2 years ago

Upon opening a new instance of VSCode, these processes do not appear in process explorer.

Screen Shot 2022-05-12 at 7 34 47 AM
RiccardoGrigoletto commented 2 years ago

Same Issue here with M1 Pro. Note that, in my case, I installed VS Code 1 day ago and not used it at all, I just opened the program once to verify the installation.

Screenshot 2022-06-14 at 08 36 37 Screenshot 2022-06-14 at 08 37 05 rigr@Riccardos-MacBook-Pro ~ % ps aux | grep 5009 rigr 5009 397.1 0.1 456362256 10848 ?? R 10:48AM 1050:07.39 /private/var/folders/rx/l1_q8xhj5fl14ktr8m0gtb_40000gn/T/AppTranslocation/6FDA13BD-289C-4EB1-AA92-6A8898E39F87/d/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer) --type=renderer --user-data-dir=/Users/rigr/Library/Application Support/Code --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --bypasscsp-schemes --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --streaming-schemes --app-path=/private/var/folders/rx/l1_q8xhj5fl14ktr8m0gtb_40000gn/T/AppTranslocation/6FDA13BD-289C-4EB1-AA92-6A8898E39F87/d/Visual Studio Code.app/Contents/Resources/app --no-sandbox --no-zygote --node-integration-in-worker --disable-color-correct-rendering --lang=en-GB --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --renderer-client-id=5 --launch-time-ticks=4271716250 --shared-files --field-trial-handle=1718379636,2816795883407190807,8334812983944564800,131072 --disable-features=PlzServiceWorker,SpareRendererForSitePerProcess --vscode-window-config=vscode:d720a6ce-fc59-491c-a368-442cff9e3aa8 --vscode-window-kind=shared-process rigr 26504 0.0 0.0 407963472 464 s001 R+ 8:33AM 0:00.00 grep 5009

RiccardoGrigoletto commented 2 years ago

Update: I force killed the process Code Helper (Renderer) from activity monitor and restarted VS Code. The process Code Helper (Renderer) now looks stable and it's not eating any CPU.

I am not sure, it could be a first-run issue that gets solved automatically.

Bovey0809 commented 2 years ago

Could you please fix the bug as soon as possible, it makes the Vscode unusable.

M00N-MAN commented 2 years ago

Hi

On macOS each (re)starting of VSCode triggers these Code Helper (Renderer/GPU) instances to consume over 80% of CPU with no observable/obvious reason even if vscode is running in the background (literally isn't visible on desktop via WindowsServer)

Version: 1.68.1 Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630 Date: 2022-06-14T12:52:13.188Z Electron: 17.4.7 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin x64 19.6.0

even if ~/.vscode/settings.json has

"files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/tmp": true,
        "**/node_modules": true,
        "**/bower_components": true,
        "**/dist": true
    },
    "files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/**": true,
        "**/tmp/**": true,
        "**/bower_components/**": true,
        "**/dist/**": true
    }

please let me know how can i help you to collect the necessary logs to engage and resolve this annoying behavior. image

nero-angela commented 2 years ago

I confirmed that the settings-sync extension was causing the problem, and it was resolved by turning off the extension.

M00N-MAN commented 2 years ago

I confirmed that the settings-sync extension was causing the problem, and it was resolved by turning off the extension.

Hello @nero-angela, I think that this is offtopic, actually because I have no such extension which you mentioned, and the problem described in subject still exists on Version: 1.69.1 Commit: b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a Date: 2022-07-12T08:21:51.333Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Darwin x64 19.6.0

UPD: no diff in behavior with image

and it doesn't matter if my extensions are turned ON or OFF (i even tried to temporarily rename the extensions directory in ~/.vscode and restart the vscode. it didn't help.

this is my list of extensions: $ ls -1 ~/.vscode/extensions/ bierner.markdown-mermaid-1.14.2 cheshirekow.cmake-format-0.6.11 go2sh.cmake-integration-vscode-0.7.1 ibm.output-colorizer-0.1.2 llvm-vs-code-extensions.vscode-clangd-0.1.21 mhutchie.git-graph-1.30.0 ms-python.python-2022.10.1 ms-python.vscode-pylance-2022.7.30 ms-python.vscode-pylance-2022.7.40 ms-vscode-remote.remote-containers-0.241.3 ms-vscode-remote.remote-ssh-0.84.0 ms-vscode-remote.remote-ssh-edit-0.80.0 ms-vscode.cmake-tools-1.11.26 ms-vscode.cpptools-1.11.2-darwin-x64 ms-vscode.cpptools-1.11.3-darwin-x64 ms-vscode.cpptools-1.11.4-darwin-x64 nickdemayo.vscode-json-editor-0.3.0 twxs.cmake-0.0.17

cpptools is only for debugging. by def it is turned off because I'm using clangd

Hello @deepak1556, I hope you are doing well

Could you please specify which information you need to push this current ticket forward, and how to get this info for you?

CodingCanuck commented 2 years ago

@deepak1556 I took a process sample from OS X's activity monitor when this happened right now on my M1 Macbook Pro. Is there any other information you need someone to capture the next time this happens?

Full process sample text (too large for a single GitHub comment): https://controlc.com/e3f959c0c

Aggio98 commented 2 years ago

This problem is also happening to me I am a beginner and do not know what to do. Can someone help?

amecreate commented 2 years ago

macOS Monterey v12.2.1 new installation of vscode from https://code.visualstudio.com/Download. Opened code then closed. Code Helper caused overheating to 90 C until force quit. Edit: installation from Homebrew does not have overheating issue so far.

M00N-MAN commented 2 years ago

@deepak1556 I took a process sample from OS X's activity monitor when this happened right now on my M1 Macbook Pro. Is there any other information you need someone to capture the next time this happens?

Full process sample text (too large for a single GitHub comment): https://controlc.com/e3f959c0c

Dear @CodingCanuck, @bpasero and all, I don't think that @deepak1556 has time for this issue according to his commitment history since April (current issue started in April as well) image I mean that this issue could be too hard to be resolved/investigate only by one developer.

Dear @bpasero and @rebornix could you please share how developers are assigned per issue and how progress is tracked? Dear @deepak1556 could you please share your ETA, your assumptions about the possible reason, and missing info in this thread to resolve/push this issue?

As well, I'd like to ask developers to share here a brief explanation about the purpose of such a process (Renderer) the purpose of its amount and a possible way to decrease this amount for troubleshooting purposes.

steps to reproduce:

perhaps some changes could be just reverted while performance stability per such features aren't well designed?

M00N-MAN commented 2 years ago

macOS Monterey v12.2.1 new installation of vscode from https://code.visualstudio.com/Download. Opened code then closed. Code Helper caused overheating to 90 C until force quit. Edit: installation from Homebrew does not have overheating issue so far.

Dear @amecreate i've just tried vscode from brew.

sudo mv /Applications/Visual\ Studio\ Code.app /Applications/Visual\ Studio\ Code_MS.app sudo mv /usr/local/bin/code /usr/local/bin/code_ms brew install visual-studio-code
running=brew install visual-studio-code ==> Downloading https://update.code.visualstudio.com/1.69.2/darwin/stable Already downloaded: /Users/master/Library/Caches/Homebrew/downloads/04932cff610f2130de44f54ea565bb893de9f948a9e43e992abae1a6b3f10fe3--VSCode-darwin.zip ==> Installing Cask visual-studio-code ==> Moving App 'Visual Studio Code.app' to '/Applications/Visual Studio Code.app' ==> Linking Binary 'code' to '/usr/local/bin/code' 🍺 visual-studio-code was successfully installed!

And it didn't help: as I already showed above tens of Code Helper Renderer processes continued consuming the CPU for 3-5 minutes just straight after I started the code image

amecreate commented 2 years ago

macOS Monterey v12.2.1 new installation of vscode from https://code.visualstudio.com/Download. Opened code then closed. Code Helper caused overheating to 90 C until force quit. Edit: installation from Homebrew does not have overheating issue so far.

Dear @amecreate i've just tried vscode from brew.

sudo mv /Applications/Visual\ Studio\ Code.app /Applications/Visual\ Studio\ Code_MS.app sudo mv /usr/local/bin/code /usr/local/bin/code_ms brew install visual-studio-code running=brew install visual-studio-code ==> Downloading https://update.code.visualstudio.com/1.69.2/darwin/stable Already downloaded: /Users/master/Library/Caches/Homebrew/downloads/04932cff610f2130de44f54ea565bb893de9f948a9e43e992abae1a6b3f10fe3--VSCode-darwin.zip ==> Installing Cask visual-studio-code ==> Moving App 'Visual Studio Code.app' to '/Applications/Visual Studio Code.app' ==> Linking Binary 'code' to '/usr/local/bin/code' 🍺 visual-studio-code was successfully installed!

And it didn't help: as I already showed above tens of Code Helper Renderer processes continued consuming the CPU for 3-5 minutes just straight after I started the code

My workflow:

  1. Open Terminal
  2. In Terminal, navigate to the directory using cd command
  3. Type code . to open vscode in the desired directory

I noticed that double clicking to open vscode will make it go haywire, at least in my case

M00N-MAN commented 2 years ago

macOS Monterey v12.2.1 new installation of vscode from https://code.visualstudio.com/Download. Opened code then closed. Code Helper caused overheating to 90 C until force quit. Edit: installation from Homebrew does not have overheating issue so far.

Dear @amecreate i've just tried vscode from brew. sudo mv /Applications/Visual\ Studio\ Code.app /Applications/Visual\ Studio\ Code_MS.app sudo mv /usr/local/bin/code /usr/local/bin/code_ms brew install visual-studio-code running=brew install visual-studio-code ==> Downloading https://update.code.visualstudio.com/1.69.2/darwin/stable Already downloaded: /Users/master/Library/Caches/Homebrew/downloads/04932cff610f2130de44f54ea565bb893de9f948a9e43e992abae1a6b3f10fe3--VSCode-darwin.zip ==> Installing Cask visual-studio-code ==> Moving App 'Visual Studio Code.app' to '/Applications/Visual Studio Code.app' ==> Linking Binary 'code' to '/usr/local/bin/code' 🍺 visual-studio-code was successfully installed! And it didn't help: as I already showed above tens of Code Helper Renderer processes continued consuming the CPU for 3-5 minutes just straight after I started the code

My workflow:

  1. Open Terminal
  2. In Terminal, navigate to the directory using cd command
  3. Type code . to open vscode in the desired directory

I noticed that double-clicking to open vscode will make it go haywire, at least in my case

In my case, I'm starting code always from the terminal but not as code . but just codebecause I have at least two projects always to work with in parallel: some cpp lib and python project which depends on it. So It is not my option to start code only in one place. When code is being restarted after battery discharge or session restored from hibernate (mac os has nothing like real hibernate, nvmd) vscode opens the existing session even with a list of unsaved files

@amecreate could you please share: ls -1 ~/.vscode/extensions to compare with my list your os version your vscode version

deepak1556 commented 2 years ago

@CodingCanuck thanks for the process sample, the sample currently lacks VSCode version information. Can you provide the output of the menu Code > About Visual Studio Code. Thanks!

@M00N-MAN can you provide the process sample of the affected ones showing high cpu usage ? In https://github.com/microsoft/vscode/issues/148226#issuecomment-1197145765 I see the main process launched by executable /Applications/Visual Studio Code.app/Contents/MacOS/Electron also showing a high CPU usage. Also include this process when collecting the sample.

Also, can users in this thread check if the issue happens with our exploration build that is built with a newer version of the runtime to rule out any runtime related issues.

CodingCanuck commented 2 years ago

@CodingCanuck thanks for the process sample, the sample currently lacks VSCode version information. Can you provide the output of the menu Code > About Visual Studio Code. Thanks!

Version: 1.69.2 (Universal)
Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a
Date: 2022-07-18T16:12:57.074Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Darwin arm64 21.5.0
7freaks-otte commented 2 years ago

I don't know if this is related, but I was experiencing the same issue for months now until I just had the message "The TypeScript language service died unexpectedly 5 times in the last 5 Minutes." without even having a TypeScript project open.

So I searched and found that issue: https://github.com/microsoft/vscode/issues/88163

@mjbvz suggests to install the extension ms-vscode.vscode-typescript-next in order to let VSCode use the latest TypeScript internally (does not affect workspace settings).

And voilà after restarting VSCode the Code Helper process spiked for 5 seconds and then dropped to normal. Hopefully this lasts and might help someone else.

theJasonFan commented 2 years ago

FWIW I am also experiencing the issue of Code Helper (Renderer) active using CPU when VS Code has been quit. Unfortunately I am having trouble reproducing it.

Version:

Version: 1.70.0 (Universal)
Commit: da76f93349a72022ca4670c1b84860304616aaa2
Date: 2022-08-04T04:38:55.829Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Darwin arm64 21.6.0

Extensions:

$ ls -1 ~/.vscode/extensions/
rust-lang.rust-analyzer-0.3.1148-darwin-arm64
SunshowerC commented 2 years ago

I confirmed that the settings-sync extension was causing the problem, and it was resolved by turning off the extension.

same problem here. In my case, disabled code-settings-sync extension solved the problem.

M00N-MAN commented 2 years ago

I confirmed that the settings-sync extension was causing the problem, and it was resolved by turning off the extension.

same problem here. In my case, the disabled code-settings-sync extension solved the problem.

fortunately or unfortunately it is off by default on my side. so it doesn't seem to be the root cause or trigger of it

zachhardesty7 commented 2 years ago

I haven't seen anyone post about this elsewhere, so here's a block of text about what happened to me and what fixed it. I've seen the renderer process eat up a pretty constantly high CPU, getting worse the longer VSCode is open until it eventually freezes the entire program indefinitely (let it sit 30+ minutes).

For me, VSCode would only start getting worse while the "Problems" panel was open. It would get bad enough that trying to type a word in the editor would freeze for a second or two after every letter. Switching to another panel like "Terminal" and back would entirely freeze VSCode for multiple seconds, but even just sitting there, not touching anything with the window hidden, would cause high CPU when "Problems" was open.

I'm running the latest insiders build on a multi-thousand file TypeScript project (plus dependencies) with a tsc --watch running from a VSCode task with a problem matcher set up. I profiled extensions, tsserver, etc so many times and removed some things causing slowdowns. This improved editor performance, sometimes notably, but I continued my descent into the madness of a laggy editor.

I profiled the window from "JavaScript profiler" in the VSCode devtools today and triggered a handful of lag spikes. I saw 1 specific function (in workbench.desktop.main.js, named _) that seemed to be taking up to 5 seconds to run in the flame graph. In minified form, I could only tell it was something regex related. Hit it with a breakpoint and figured out it was the filter bar in the "Problems" panel. Removing the filter text seems to have fixed my issues. I don't think the filter I had was crazy, just filtering out a few files, but seems it checks as often as the problems panel updates, which can be every keystroke. Not sure if it's been getting slower in VSCode's side, but we've added a bunch of new ESLint rules and other things that show up in the "Problems" panel to our project recently. For the record, the filter text looked like this: !**/FileName1.scss,!**/FileName2.js,!**/angular.js,!**/FileName3.tsx[],!**/?/settings.json,!**/build/**,!**/?/workspaceSettings.json,!**/FileName5.jsp

It's probably not the exact same issue as OP, but hopefully this helps someone!

Detnator-Neo commented 2 years ago

I'm having a slightly different but I suspect related problem. Fully loaded MacBook Pro 16" M1 Max. I'm coding away and every few seconds VSCode stops responding to clicks and keystrokes (but no beachball). Then a few seconds later all clicks and keystrokes I did while it was unresponsive then happen in order.

Running Activity Monitor next to it so I can see at a glance what might be happening, every time this happens I see Code Helper (Renderer) process eating 96+% of CPU. Then a few seconds later, that process in Activity Monitor drops to near zero, at the same moment VSCode becomes responsive again.

Unlike others above, it's happening while I'm coding, not with VSCode quit, and it's only happening momentarily, although I think more frequently and for a little longer each time, I think.

If this should be a separate issue, let me know and I'll post it as such.

AmyTheCute commented 2 years ago

I also was having this issue, Removing the app from the applications folder did not help. I ran -rm commands on folders I found it to install from google searches, that improved the heat a lot but my laptop was still hotter and lasting 6h instead of the usual 12-15h (browsing) so I finally found that force quitting Code Helper from Visual studio code in activity monitor helped me fix the issue, I wonder if it'll pop back

JasonJayKim commented 2 years ago

I don't know if this is related, but I was experiencing the same issue for months now until I just had the message "The TypeScript language service died unexpectedly 5 times in the last 5 Minutes." without even having a TypeScript project open.

So I searched and found that issue: #88163

@mjbvz suggests to install the extension ms-vscode.vscode-typescript-next in order to let VSCode use the latest TypeScript internally (does not affect workspace settings).

And voilà after restarting VSCode the Code Helper process spiked for 5 seconds and then dropped to normal. Hopefully this lasts and might help someone else.

This helps me!!! (M1 pro macOS Monterey v12.4) In my case, disabled ms-vscode.vscode-typescript-next extension solved the problem.

M00N-MAN commented 2 years ago

@CodingCanuck thanks for the process sample, the sample currently lacks VSCode version information. Can you provide the output of the menu Code > About Visual Studio Code. Thanks!

@M00N-MAN can you provide the process sample of the affected ones showing high cpu usage ? In #148226 (comment) I see the main process launched by executable /Applications/Visual Studio Code.app/Contents/MacOS/Electron also showing a high CPU usage. Also include this process when collecting the sample.

Also, can users in this thread check if the issue happens with our exploration build that is built with a newer version of the runtime to rule out any runtime related issues. Hi @deepak1556 Please let me know if this is enough or not Sample of Code Helper2.txt Spindump2.txt Spindump.txt Sample of Code Helper.txt

M00N-MAN commented 2 years ago

I haven't seen anyone post about this elsewhere, so here's a block of text about what happened to me and what fixed it. I've seen the renderer process eat up a pretty constantly high CPU, getting worse the longer VSCode is open until it eventually freezes the entire program indefinitely (let it sit 30+ minutes).

For me, VSCode would only start getting worse while the "Problems" panel was open. It would get bad enough that trying to type a word in the editor would freeze for a second or two after every letter. Switching to another panel like "Terminal" and back would entirely freeze VSCode for multiple seconds, but even just sitting there, not touching anything with the window hidden, would cause high CPU when "Problems" was open.

I'm running the latest insiders build on a multi-thousand file TypeScript project (plus dependencies) with a tsc --watch running from a VSCode task with a problem matcher set up. I profiled extensions, tsserver, etc so many times and removed some things causing slowdowns. This improved editor performance, sometimes notably, but I continued my descent into the madness of a laggy editor.

I profiled the window from "JavaScript profiler" in the VSCode devtools today and triggered a handful of lag spikes. I saw 1 specific function (in workbench.desktop.main.js, named _) that seemed to be taking up to 5 seconds to run in the flame graph. In minified form, I could only tell it was something regex related. Hit it with a breakpoint and figured out it was the filter bar in the "Problems" panel. Removing the filter text seems to have fixed my issues. I don't think the filter I had was crazy, just filtering out a few files, but seems it checks as often as the problems panel updates, which can be every keystroke. Not sure if it's been getting slower in VSCode's side, but we've added a bunch of new ESLint rules and other things that show up in the "Problems" panel to our project recently. For the record, the filter text looked like this: !**/FileName1.scss,!**/FileName2.js,!**/angular.js,!**/FileName3.tsx[],!**/?/settings.json,!**/build/**,!**/?/workspaceSettings.json,!**/FileName5.jsp

It's probably not the exact same issue as OP, but hopefully this helps someone! Hi @zachhardesty7

your story looks pretty good, but I can't confirm it is close to the root cause because in my case I have only:

M00N-MAN commented 2 years ago

I don't know if this is related, but I was experiencing the same issue for months now until I just had the message "The TypeScript language service died unexpectedly 5 times in the last 5 Minutes." without even having a TypeScript project open. So I searched and found that issue: #88163 @mjbvz suggests to install the extension ms-vscode.vscode-typescript-next in order to let VSCode use the latest TypeScript internally (does not affect workspace settings). And voilà after restarting VSCode the Code Helper process spiked for 5 seconds and then dropped to normal. Hopefully this lasts and might help someone else.

This helps me!!! (M1 pro macOS Monterey v12.4) In my case, disabled ms-vscode.vscode-typescript-next extension solved the problem.

Hi @JasonJayKim so obviously this is not vscode issue and offtopic in this thread image

M00N-MAN commented 2 years ago

Closed vscode... Code helper still in progress image Spindump4.txt Spindump3.txt Sample of Code Helper4.txt Sample of Code Helper3.txt it has something about pylance in it's command line, but this is different from what I had recently. switchng pylance to pre-release version and restarting to see the result

restarted vscode. image

image Spindump6.txt Spindump5.txt Sample of Code Helper6.txt Sample of Code Helper5.txt didn't help... turning off pylance...restarting image no pylance in command, one process stayed longer (and still why i have so many renderers melting my cpu if vscode is not showed by window server Sample of Code Helper (Renderer)8.txt Sample of Code Helper (Renderer)7.txt it took less time so didn't took the spindump from the first attempt Spindump8.txt Spindump7.txt

In https://github.com/microsoft/vscode/issues/148226#issuecomment-1197145765 I see the main process launched by executable /Applications/Visual Studio Code.app/Contents/MacOS/Electron also showing a high CPU usage. Also include this process when collecting the sample. @deepak1556, the main issue is that ProcessMonitor in macos becomes unresponsive during the current thread subject.

I just can't spindump/samplecode suspect processes of vscode.

There are a lot of vscode/Code Helper(Renderer) processes that consume all the cores at the first 2-10 minutes (about 16 and consuming per process jumps between 7..16..30..80 % of core) How to capture all the vscode process samples with all children starting from running the code command in the terminal?

fyi: Version: 1.71.2 Commit: 74b1f979648cc44d385a2286793c226e611f59e7 Date: 2022-09-14T21:05:37.721Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin x64 19.6.0 Sandboxed: No

upd: managed to capture Electron (main process) SpindumpE.txt Sample of CodeE.txt Please let me know if something more could help with the analysis of this annoying issue

ajmas commented 2 years ago

I too am running into an issue where I am running into high CPU, though the process explorer seems to have a granularity issue, meaning it is hard to identify the real culprit:

image

Here we see "shared-process" at 66% CPU, yet nothing below show any CPU usage. Using top -u on the CLI confirms the 66% CPU usage of "Code Helper".

Copying the output of the process explorer, to get processes:

shared-process
  ptyHost
  fileWatcher
window (OpeningsService.ts — my-server)

extensionHost

/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/sj/j454ybpx3tbbngp006kmm5f00000gn/T/vscode-typescript501/577e1bf040b11523300c/tscancellation-1a8a4434617b7e04b648.tmp* --globalPlugins @vsintellicode/typescript-intellicode-plugin,ms-vsintellicode-typescript --pluginProbeLocations /Users/ajmas/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.28,/Users/ajmas/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.28 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/sj/j454ybpx3tbbngp006kmm5f00000gn/T/vscode-typescript501/577e1bf040b11523300c/tscancellation-463b1cb45c1a5ecc682b.tmp* --globalPlugins @vsintellicode/typescript-intellicode-plugin,ms-vsintellicode-typescript --pluginProbeLocations /Users/ajmas/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.28,/Users/ajmas/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.28 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
  /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /Users/ajmas/Library/Caches/typescript/4.8 --enableTelemetry --typesMapLocation /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/ajmas/.vscode/extensions/shinnn.stylelint-0.51.0/server.js --stdio --clientProcessId=59829
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/ajmas/.vscode/extensions/formulahendry.auto-rename-tag-0.1.10/packages/server/dist/serverMain.js --node-ipc --clientProcessId=59829
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/ajmas/.vscode/extensions/kisstkondoros.vscode-gutter-preview-0.30.0/dist/server.js --node-ipc --clientProcessId=59829
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/ajmas/.vscode/extensions/visualstudioexptteam.intellicode-api-usage-examples-0.2.4/dist/server/server.js --node-ipc --clientProcessId=59829
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/ajmas/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js --node-ipc --clientProcessId=59829
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/ajmas/.vscode/extensions/vue.volar-0.40.13-darwin-x64/server --node-ipc --clientProcessId=59829
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/ajmas/.vscode/extensions/vue.volar-0.40.13-darwin-x64/server --node-ipc --clientProcessId=59829
/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=59829

Doing a ps auxwww | grep xxxx where 'xxxx' is the "Code Helper" pid (adjusted formatting slightly):

/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer) 
  --type=renderer --user-data-dir=/Users/ajmas/Library/Application Support/Code  --standard-schemes=vscode-webview,vscode-file 
  --secure-schemes=vscode-webview,vscode-file --bypasscsp-schemes --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file 
  --service-worker-schemes=vscode-webview --streaming-schemes --app-path=/Applications/Visual Studio Code.app/Contents/Resources/app 
  --no-sandbox --no-zygote --node-integration-in-worker --lang=en-GB 
  --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation 
  --renderer-client-id=13 --launch-time-ticks=562762852214 --shared-files 
  --field-trial-handle=1718379636,r,5706725237324005258,14948090103218166706,131072 
  --disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess --vscode-window-config=vscode:97aa85b0-6b84-4ef4-a18b-a1b413a6c0d3 
  --vscode-window-kind=shared-process

BTW all this is with one workspace open. I had to close down other workspaces, since it was blowing through my CPU.

Environment:

About window env info

Version: 1.71.2
Commit: 74b1f979648cc44d385a2286793c226e611f59e7
Date: 2022-09-14T21:05:37.721Z (2 wks ago)
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 21.6.0
Sandboxed: No

Attaching the console output for the workspace that was still open:

vscode-console-log.txt

Also decided to run spin dump, to see if it can provide the devs anything useful:

Update:

Today I decided to a kill -1 <pid> on the "Code Helper" process and for now it has resolved the CPU issue, but being a bit of a blind kill, I am not sure what this particular "Code Helper" was trying to do.

Please suggest anything else that would help identify the issue.

M00N-MAN commented 2 years ago

Hi @deepak1556,

Could you please share which tool you use for analysis of performance issues with the given spindumps/samples of vscode in this thread? (maybe you can share some links to the guide about it?)

When we can receive any info/update/workaround for the current issue from your/maintainers' side at least approximately?

How else can we help you in resolving this issue?

Hi @ajmas,

Today I decided to a kill -1 on the "Code Helper" process and for now it has resolved the CPU issue, but being a bit of a blind kill, I am not sure what this particular "Code Helper" was trying to do.

this "helps" only 1/10 times in my case, otherwise, the process is just being restarted by vscode.

with best regards

M00N-MAN commented 2 years ago

I just didn't get it, can you reproduce it or not image image

M00N-MAN commented 2 years ago

image

maxoppelt commented 2 years ago

The issue also occurs with

Steps to Reproduce:

ps aux <PID>
<USER>  <PID> 100,0  2,8 71937192 471344   ??  R    10:51am   9:25.75 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/<USER>/.vscode/extensions/ms-python.vscode-pylance-2022.10.40/dist/server.bundle.js --canc

Probably Related:

Already in settings:

"files.exclude": {
    "**/__pycache__": true,
    "**/.pytest_cache": true,
    "**/.git": true,
    "**/.DS_Store": true,
    "**/tmp": true
},

"files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/tmp/**": true,
},
AurevoirXavier commented 2 years ago

https://github.com/mhutchie/vscode-git-graph/issues/712 https://github.com/gitkraken/vscode-gitlens/issues/2389

Same issue.

Once I open the git-graph plugin, vscode will freeze.

M00N-MAN commented 2 years ago

mhutchie/vscode-git-graph#712

Same issue.

Once I open the git-graph plugin, vscode will freeze.

Hi, I don't confirm it.

Rather I say the opposite: mhutchie.git-graph isn't impacting that topic at all from my side.

Turning off the git graph extension and restarting the vscode: the same problem with CPU load in the beginning Turning on the git graph extension doesn't make any additional load, nor before nor after the restart of the vscode.

Thanks for the idea, nice try)

M00N-MAN commented 2 years ago

The issue also occurs with

  • VS Code Version:
code --version
1.72.2
d045a5eda657f4d7b676dedbfa7aab8207f8a075
x64
electron 19.0.17
  • OS Version:
sw_vers
ProductName:  macOS
ProductVersion:   12.6.1
BuildVersion: 21G217

Steps to Reproduce:

ps aux <PID>
<USER>  <PID> 100,0  2,8 71937192 471344   ??  R    10:51am   9:25.75 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/<USER>/.vscode/extensions/ms-python.vscode-pylance-2022.10.40/dist/server.bundle.js --canc

Probably Related:

Already in settings:

"files.exclude": {
    "**/__pycache__": true,
    "**/.pytest_cache": true,
    "**/.git": true,
    "**/.DS_Store": true,
    "**/tmp": true
},

"files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/tmp/**": true,
},

Hi, I've tried to turn off any pylance-related extensions. A clean start with turned-off extension (pylance) doesn't make any difference to the renderer: its instances still are consuming a lot of CPU during the first 5-10 minutes.

Thanks

M00N-MAN commented 2 years ago

Hi @hediet, Could you please share your opinion about why this topic doesn't have any valuable updates for so long time?

M00N-MAN commented 2 years ago

Hi @deepak1556, Could you please share your opinion about why this topic doesn't have any valuable updates for so long time?

How could attendees of this topic help you to push it forward?

dmitryshelomanov commented 1 year ago
ozgurrgul commented 1 year ago

I think the record is mine. The only extension I have is prettier. 2 instance of VScode is open with small typescript projects.

image
aka-vm commented 1 year ago

I tried so many things, and they worked at first, but not anymore(check history)

ozgurrgul commented 1 year ago

@aka-vm Thanks for suggestion. I didn't see improvement when I turn off extension. (Since as I mentioned the only extension I use is prettier)

HenryC-3 commented 1 year ago

mhutchie/vscode-git-graph#712 gitkraken/vscode-gitlens#2389

Same issue.

Once I open the git-graph plugin, vscode will freeze.

same here