microsoft / vscode

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

Code Helper (plugin) uses 100% of CPU #219075

Closed ravm closed 3 days ago

ravm commented 2 weeks ago

Type: Performance Issue

Whenever I have VS Code active, the Code Helper (Plugin) jumps to 100% CPU usage and the editor runs very slow. The issue is also currently in the Insiders build. Tested with and without extensions, but the problem still persists. This issue makes the software pretty much unusable. This issue has been with the stable version for weeks, and begun earlier this week with Insiders.

VS Code version: Code 1.90.2 (Universal) (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:37:41.291Z) OS version: Darwin x64 23.5.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 4, 3| |Memory (System)|16.00GB (0.73GB free)| |Process Argv|--crash-reporter-id 155ca6df-0290-464a-b439-dfdd04f2659f| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 6 328 79060 code main 0 66 79063 gpu-process 0 33 79064 utility-network-service 7 344 79065 window [1] (test.ts — test) 0 115 79069 shared-process 0 0 79173 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 100 295 79071 extensionHost [1] 0 164 79129 electron-nodejs (bundle.js ) 0 49 79072 ptyHost 0 0 79151 /bin/zsh -il 0 49 79149 fileWatcher [1] 100 180 79150 extensionHost [1] 0 98 79154 electron-nodejs (tsserver.js ) 0 98 79155 electron-nodejs (tsserver.js ) 0 49 79163 electron-nodejs (typingsInstaller.js typesMap.js ) 0 360 79166 window 1 66 79171 window [2] (Issue Reporter) ```
Workspace Info ``` | Window (test.ts — test) | Folder (test): 4 files | File types: json(1) js(1) py(1) ts(1) | Conf files:; ```

Extensions: none

A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelc:31048052
dsvsc021:30996838
9c06g630:31013171
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
legacy_priority:31082724

Image 28 6 2024 at 13 24

The PID info: 79209 100.0 1.1 1219874056 192284 ?? R 1:19PM 2:31.80 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --type=utility --utility-sub-type=node.mojom.NodeService --lang=en-US --service-sandbox-type=none --dns-result-order=ipv4first --inspect-port=0 --user-data-dir=/Users/ravm/Library/Application Support/Code --standard-schemes=vscode-webview,vscode-file --enable-sandbox --secure-schemes=vscode-webview,vscode-file --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --code-cache-schemes=vscode-webview,vscode-file --shared-files --field-trial-handle=1718379636,r,7660773470862932915,4635936302933485549,262144 --enable-features=ScreenCaptureKitPickerScreen,ScreenCaptureKitStreamPickerSonoma,kWebSQLAccess --disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess --variations-seed-version ravm 79268 0.0 0.0 34121244 556 s002 U+ 1:22PM 0:00.00 grep 79209

Image 25 6 2024 at 10 30

ravm commented 2 weeks ago

It looks like the extensionHost becomes unresponsive and that's when the CPU usage jumps to 100%.

Image 1 7 2024 at 8 36

Image 1 7 2024 at 8 31

ravm commented 2 weeks ago

CPU profile: CPU-20240701T114926.170Z.cpuprofile.txt

needfulthing commented 5 days ago

I have a similar problem (macOS 14.5 / VS Code 1.91.0) with Code Helper (plugin) referring to Visual Studio IntelliCode eating up 100% CPU. It looks like it correlates with the usage of new unsaved tabs with lots of pasted data.

aikrom commented 4 days ago

Same problem.

mjbvz commented 4 days ago

@chrmarti CPU profile shows the hang in addCACert

jrieken commented 3 days ago

Looks like some extension is trying establish a connection in the first place...

Image

@ravm Can you do F1 > Running Extensions and start a profile run from there. When done it should mark the extension that took must of the time. Please share that (screenshot is enough). Thanks!

chrmarti commented 3 days ago

It seems to be stuck adding certificates to the request's secure context. Maybe there is a large number of certificates being added.

@ravm Could you install the Network Proxy Test extension (https://marketplace.visualstudio.com/items?itemName=chrmarti.network-proxy-test) and check the output of F1 > Network Proxy Test: Show OS Certificates? How many certificates does that list?

ravm commented 3 days ago

@jrieken Do you mean a heapprofile or a CPU profile? @chrmarti Ran it, the output showed over 74 000 certificates. Those certificates were used in a project and for some reason were being saved to my Default Keychains. Since they are no longer valid, I deleted them, and now VS Code works!