microsoft / vscode

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

Code helper usage 99.9 of my cpu on my mac #203178

Closed SalmanShapana closed 8 months ago

SalmanShapana commented 9 months ago

Type: Performance Issue

When I use Visual Studio Code to write some code, I suddenly notice that my Mac becomes very hot. Upon closer inspection, I realize that something strange is happening. When I quit or close Visual Studio Code, the Mac returns to its normal state, and the heat dissipates. Upon reopening VSC, the issue occurs again, and the temperature of the Mac rises significantly. I open the Activity Monitor on my Mac and observe that Code Helper is using 99.9% of my CPU.

VS Code version: Code 1.85.2 (Universal) (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:32.531Z) OS version: Darwin arm64 23.2.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 2, 2| |Memory (System)|8.00GB (0.12GB free)| |Process Argv|--crash-reporter-id 7ef1f142-0a87-4a46-b4a2-69c9bae78168| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 39 246 17161 code main 1 82 17165 gpu-process 0 41 17166 utility-network-service 1 393 17174 window [1] (file.txt — gitLearn & GitHub) 0 115 17188 shared-process 0 0 17399 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 57 17202 ptyHost 0 0 17205 /bin/bash --init-file /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh 0 57 17347 fileWatcher [1] 0 98 17348 extensionHost [1] 0 98 17395 window [2] (Issue Reporter) ```
Workspace Info ``` | Window (file.txt — gitLearn & GitHub) | Folder (gitLearn & GitHub): 2 files | File types: txt(1) | Conf files:; ```

Extensions: none

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
vsclangdc:30486549
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30933248
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302

lucasyvas commented 9 months ago

There is something very wrong happening for me as well. The entire workbench is unusable and I see the same thing. This is definitely the result of a recent change.

lucasyvas commented 9 months ago

Actually I take it back, I rolled back to 1.85.2 and it's still pinned to 99%. What's happening? 🤔

gjsjohnmurray commented 9 months ago

/confirmPlease

vscodenpa commented 9 months ago

Please diagnose the root cause of the issue by running the command F1 > Help: Troubleshoot Issue and following the instructions. Once you have done that, please update the issue with the results.

Happy Coding!

lucasyvas commented 9 months ago

In my case, it is reproducible immediately - when installing Insiders, it doesn't seem to have the helper processes pinned to 100% so... hopefully resolved?

lucasyvas commented 9 months ago

For what it's worth, I think the extension host is involved. Killing the process seems to have VS Code display an error in the status bar say the extension host was killed. So it may be a greedy extension, or mishandling of extension(s) within the host itself. I could not say, however this is brand new behaviour and bisecting extensions during troubleshooting didn't resolve it. It's hard to say what could be at fault.

lance631 commented 9 months ago

I have the same problem !!!🤔🤔🤔 Steps

  1. Modified the content in the style in the vue file, such as "margin-top"
  2. vscode will pop up the following picture pop-up box
  3. cup is 99%, code helper plugin, detailed information is as shown in the screenshot below
  4. In my judgment, there is something wrong with the extension. It may be vue (volar), or it may be eslint, i18n ally and other extensions that handle styles. I am not sure.
image image
SanderElias commented 9 months ago

I seem to have issues with this, too. I took a capture of what happens when I boot code-insiders:

image

So, all that activity is only starting up code. It takes a good 2 minutes, and up to ~15Gb of memory before it stabilizes. I suspect one of more plugins, but I would love to learn how to diagnose this!

gjsjohnmurray commented 9 months ago

@SanderElias the Start Extension Bisect command may help you investigate.

SanderElias commented 9 months ago

@gjsjohnmurray That helped. It seems to be the "GitHub copilot chat". But as it doesn't appear all the time I'm not yet 100% convinced.

gjsjohnmurray commented 9 months ago

The Report Issue option from the Help menu can help you direct your report to the extension author.

lucasyvas commented 9 months ago

I still think there is a chance this is not caused by any particular extension. What are the chances multiple people experienced it with different extensions within the same timeframe all of a sudden?

xusongfu commented 8 months ago

Hi guys,

My Mac Pro Version 12.6.7(Monterey), VS Code version 1.85.2.

Whether the extentions had some bugs?

I think there are some bugs in these extentions "Git Blame, Git History, GitLens".

I opend a small project with a bit of commit history, it will not cause cpu 99.99%.

But when I opend a large project with a lot of commit history, it often causes cpu 99.99%, the fan was spinning wildly, and my Mac seems to be a bom.

lucasyvas commented 8 months ago

@xusongfu I think this is probably correct. Although, it raises questions about if an extension should be able to take down the whole editor. When this happens, I can't even get basic editor features like search to work. The UI is responsive but no actions can be completed.

Isn't the entire point of the extension host for isolation? Maybe we've just hit a point where so many people rely on extensions for their work that any rogue extension basically destroys the entire editor experience?

mjbvz commented 8 months ago

@SalmanShapana Does this reproduce in the latest VS Code insiders build with all extensions disabled?

For everyone else: please open an issue against whatever extensions are causing the problem for you or open a new issue if this happens with all extensions disabled

gjsjohnmurray commented 8 months ago

Isn't the entire point of the extension host for isolation? Maybe we've just hit a point where so many people rely on extensions for their work that any rogue extension basically destroys the entire editor experience?

@lucasyvas the extension process affinity feature may help, though it brings its own costs.

https://github.com/microsoft/vscode/issues/75627#issuecomment-1078827311

vscodenpa commented 8 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!