vscode: High CPU usage when VSCODE_EXTENSIONS is set and multiple Code windows are opened

Type: Performance Issue

Starting from latest release (1.71) I observe repeating spikes (every 7-10 minutes) of CPU usage (up to 100%) caused by ‘bootstrap-fork’ processes (see screenshots below). When computer is in idle state (no user activity with mouse or keyboard one process with ‘bootstrap-fork’ is running and usages 25% of CPU continuously (it seems leak).

UPD: Video recording (proof) of Task Manager what I’m talking about:
(sorry for over compressed video, but main point should be clear)

https://user-images.githubusercontent.com/11818507/188784945-ef8bbd37-594f-4057-a059-55a807d38747.mp4

NO debug server is running.

I have 5 open Workspaces at the same time. Four of them are Python Django projects. In spite of all them are minimized (windows) frequent CPU usage continues to be a problem.

There was no such issue in previous versions of VS Code, running the same workspaces.

I tried to gather information for developers as I could, but I couldn’t find the JavaScript profiler in Developer Tools, because new window UI buttons overlap menu button (or it was removed in new version).
2022-09-06_12-21-36

Screenshots of Task Manager and Process Explorer at the moment of spike: 2022-09-06_11-50-48

File with output of code --status at another spike (I changed personal workspace names): 2022-09-06_11-34 VS Code status during 100% CPU usage by bootstrap-fork.js.txt

Command output in-place
D:\tmp>code --status

Version:          Code 1.71.0 (784b0177c56c607789f9638da7b6bf3230d47a8c, 2022-09-01T07:36:10.600Z)
OS Version:       Windows_NT x64 10.0.19044
CPUs:             Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz (4 x 3100)
Memory (System):  15.95GB (5.72GB free)
VM:               0%
Screen Reader:    no
Process Argv:     --crash-reporter-id c64bc5dd-3310-48ba-ac74-660a16150038
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_renderer:                          enabled_on
                  video_decode:                           enabled
                  video_encode:                           enabled
                  vulkan:                                 disabled_off
                  webgl:                                  enabled
                  webgl2:                                 enabled
                  webgpu:                                 disabled_off

CPU %   Mem MB     PID  Process
    0      105   21296  code main
    0       42    3948     utility-network-service
    1      176    5044     window (settings.json - Dev Settings and Snippets (Workspace) - Visual Studio Code)
    0      194    8476     window (settings.py - WorkSpaceName_1 (Workspace) - Visual Studio Code)
    0       27   19052     crashpad-handler
   20      204   19612     extensionHost
    0       78   16388       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=19612
    0      130   20180       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node D:\_vscode_extensions\ms-python.vscode-pylance-2022.8.50\dist\server.bundle.js --cancellationReceive=file:89fb5d54dc37a7d7d9a16fc2d68cf5a2c11abf3b28 --node-ipc --clientProcessId=19612
    0      173   21344       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node d:\_vscode_extensions\streetsidesoftware.code-spell-checker-2.7.2\packages\_server\dist\main.js --node-ipc --clientProcessId=19612
    1      177   19648     window (index.html - WorkSpaceName_2 (Workspace) - Visual Studio Code)
    0      103   20500     shared-process
    0       82    5264       fileWatcher
    0       74    5540       ptyHost
    0       80   20820       fileWatcher
    0       82   22324       fileWatcher
    0       82   24768       fileWatcher
    0       79   24896       fileWatcher
   21      180   20560     extensionHost
    0      169    1332       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node d:\_vscode_extensions\streetsidesoftware.code-spell-checker-2.7.2\packages\_server\dist\main.js --node-ipc --clientProcessId=20560
    0       94   10848       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=20560
    1      175   20732     window (admin.py - WorkSpaceName_3 (Workspace) - Visual Studio Code)
   17      224   22148     extensionHost
    0      188    8492       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node d:\_vscode_extensions\streetsidesoftware.code-spell-checker-2.7.2\packages\_server\dist\main.js --node-ipc --clientProcessId=22148
    0      126   21364       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node D:\_vscode_extensions\ms-python.vscode-pylance-2022.8.50\dist\server.bundle.js --cancellationReceive=file:3fb89a4b32917766f47a6b7f0535342eff28fa361c --node-ipc --clientProcessId=22148
    0       78   24152       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=22148
    1      204   22736     window (website_tests.py -WorkSpaceName_4 (Workspace) - Visual Studio Code)
    0      196   22740     extensionHost
    0      172     676       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node d:\_vscode_extensions\streetsidesoftware.code-spell-checker-2.7.2\packages\_server\dist\main.js --node-ipc --clientProcessId=22740
    0       79    2428       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=22740
    0      124   11968       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node D:\_vscode_extensions\ms-python.vscode-pylance-2022.8.50\dist\server.bundle.js --cancellationReceive=file:229790dd21656664e29367f1d6d6db4b50df7ceeb5 --node-ipc --clientProcessId=22740
    0      131   23244     gpu-process
   20      202   24452     extensionHost
    0       78    4640       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node "c:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=24452
    0      173   17564       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node d:\_vscode_extensions\streetsidesoftware.code-spell-checker-2.7.2\packages\_server\dist\main.js --node-ipc --clientProcessId=24452
    0      121   19280       "C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node D:\_vscode_extensions\ms-python.vscode-pylance-2022.8.50\dist\server.bundle.js --cancellationReceive=file:0af78e962c6e3f07f9e2fb06ea32bb37d6fd8353b8 --node-ipc --clientProcessId=24452

Workspace Stats:
|  Window (index.html - WorkSpaceName_1 (Workspace) - Visual Studio Code)
|  Window (website_tests.py - WorkSpaceName_2 (Workspace) - Visual Studio Code)
|  Window (settings.py - WorkSpaceName_3 - Visual Studio Code)
|  Window (admin.py - WorkSpaceName_4 (Workspace) - Visual Studio Code)
|  Window (settings.json - WorkSpaceName_5 (Workspace) - Visual Studio Code)
|    Folder (snippets): 7 files
|      File types: code-snippets(4) json(3)
|      Conf files:
|    Folder (LocalState): 5 files
|      File types: backup(3) json(2)
|      Conf files: settings.json(1)
|    Folder (.postgres): 2 files
|      File types: conf(2)
|      Conf files:
|    Folder (User): 4879 files
|      File types: py(826) json(785) au3(652) html(433) ps1(265) pug(263)
|                  conf(137) txt(122) js(107) vscdb(102)
|      Conf files: settings.json(2)
|    Folder (WorkSpaceName_1): 10065 files
|      File types: py(1848) pyc(1577) mo(1217) po(1217) html(190) js(182)
|                  svg(46) css(39) txt(35) exe(26)
|      Conf files: settings.json(1)
|    Folder (WorkSpaceName_2): 9652 files
|      File types: py(1808) pyc(1537) mo(1196) po(1196) html(158) js(87)
|                  txt(29) svg(26) exe(26) css(16)
|      Conf files: settings.json(1)
|    Folder (WorkSpaceName_3): 11666 files
|      File types: py(1915) pyc(1630) mo(1233) po(1233) js(1067) html(213)
|                  png(117) css(115) gif(38) txt(37)
|      Conf files: settings.json(1)
|    Folder (WorkSpaceName_4): 15292 files
|      File types: py(2731) pyc(2517) mo(1196) po(1196) pyi(915) png(858)
|                  json(480) pyd(218) js(200) html(164)
|      Conf files: makefile(3) launch.json(1) settings.json(1) package.json(1)
|      Launch Configs: python

How I can mitigate this problem (what should I disable in VS Code to prevent Extension Host running this process)? Maybe there is a timer for updating extensions? or something like that. Because I don’t want to close and re-open these Code windows every time.

VS Code version: Code 1.71.0 (784b0177c56c607789f9638da7b6bf3230d47a8c, 2022-09-01T07:36:10.600Z) OS version: Windows_NT x64 10.0.19044 Modes: Sandboxed: No

System Info
Item Value
CPUs Intel® Core™ i5-2400 CPU @ 3.10GHz (4 x 3100)
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_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 15.95GB (5.85GB free)
Process Argv –crash-reporter-id c64bc5dd-3310-48ba-ac74-660a16150038
Screen Reader no
VM 0%
Extensions (24)
Extension Author (truncated) Version
vscode-m3u af4 1.0.0
vscode-json and 1.5.2
vscode-django bat 1.10.0
autoit Dam 1.0.8
xml Dot 2.5.1
gitlens eam 12.2.1
vsc-material-theme Equ 33.2.0
vsc-material-theme-icons equ 1.2.2
prettier-vscode esb 9.8.0
unibeautify-vscode Gla 0.8.2
rainbow-csv mec 2.4.0
git-graph mhu 1.30.0
language-gettext mro 0.2.0
vscode-language-pack-ru MS- 1.71.8310916
python ms- 2022.14.0
vscode-pylance ms- 2022.8.50
gremlins nho 0.26.0
indent-rainbow ode 8.3.1
es6-css-minify olb 3.3.3
code-spell-checker str 2.7.2
code-spell-checker-russian str 2.0.6
even-better-toml tam 0.18.1
vscode-conventional-commits viv 1.24.2
cuesheet zgm 0.3.0

(1 theme extensions excluded)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 28 (10 by maintainers)

Most upvoted comments

@alexdima

I’m using VSCODE_EXTENSIONS to save space on my system disc, and simply set full path to custom folder D:\_vscode_extensions. That’s I’m using it.

It’s worth mention that there were two regular (stable) release (1.72 and 1.73) since my last message. Problem didn’t disappear completely, BUT it became less aggressive: only short (2-4 sec) CPU peak every five minutes and UNRESPONSIVE extension host line in Window Log. It’s not ideal, but I get over it 😃

Returning to your request…

I deleted VSCODE_EXTENSIONS and installed Insiders Build VSCodeUserSetup-x64-1.74.0-insider.exe. I don’t disable anything and open Window Log only.

So with this build and without environment variable - issue is GONE. I’m afraid to broke my extensions (or affect stable build), that’s why I didn’t test insiders build with environment variable.

Well, I think I’ll wait stable release of 1.74 and check with VSCODE_EXTENSIONS again and add new comment. And I hope after that we can close this issue 🤞🏻

What will be the next to disable?

Hard to say… There must be something frequently running at high cost. I was fishing for git status refreshes… You can try to profile the extension host.

  • select F1 > Show Running Extensions
  • select the ⚫ to start profiling
  • let it profile for so that you capture one of the frequent stall
  • stop profiling and please share the trace with us
  • NOTE that profiling longer than 5 minutes might produce too much data. Once you see the reoccurring pattern, try to start a minutes or less before it is expected to happen again
Screenshot 2022-09-30 at 17 16 10

the same problem