Repository: vscode
Issue: GPU-PROCESS uses 100% cpu when in the background
Labels: freeze-slow-crash-leak,gpu

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->

Wrote a script that checks cpu in the background. This is with all extensions disabled via `code-insiders --disable-extensions`.

Happens regardless of whether it's in the background or foreground being used. Weirdly, clicking iStat Menus to investigate, or swapping windows normally stops it straight away. Made it hard to debug, because swapping to see what's using cpu caused the cpu usage to drop ;)

```
#!/bin/bash

while true; do
  cpu_output=$(top -l 1 | grep -E "^CPU")
  user_cpu=$(echo "$cpu_output" | sed -E 's/CPU usage: ([0-9.]+)% user,.*/\1/')

  if (( $(echo "$user_cpu > 50" | bc -l) )); then
    code-insiders --status
  fi
  sleep 0.1
done
```
```
Version:          Code - Insiders 1.80.0-insider (79c4092768e41b16fd823e80c874dbfafdc08f55, 2023-06-13T05:44:23.177Z)
OS Version:       Darwin arm64 22.5.0
CPUs:             Apple M1 Max (10 x 24)
Memory (System):  64.00GB (1.78GB free)
Load (avg):       9, 7, 7
VM:               0%
Screen Reader:    no
Process Argv:     --disable-extensions --crash-reporter-id 26b5356f-8200-4e36-99f8-a9fed0a3214a
GPU Status:       2d_canvas:                              enabled
                  canvas_oop_rasterization:               disabled_off
                  direct_rendering_display_compositor:    disabled_off_ok
                  gpu_compositing:                        enabled
                  metal:                                  disabled_off
                  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

CPU %	Mem MB	   PID	Process
   14	   197	 89723	code-insiders main
   92	   131	 89736	   gpu-process
    0	    66	 89737	   utility-network-service
    7	   328	 89739	window [1] (index.ts — perfect-pixel-s-app)
    7	   328	 89740	window [2] (index.ts — perfect-pixel-event-classifier)
    7	   328	 89741	window [3] (api.php — perfect-pixel-web)
    7	   328	 89742	window [4] (worker.ts — spotify-queue-api)
    0	   197	 89772	extensionHost [2]
    0	   131	 89802	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/5z/cjztyn1s1rn3s2c69p59xt180000gn/T/vscode-typescript501/71051c709bca268ebe67/tscancellation-6b26c86886ef0ffe1dc4.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc)
    0	   131	 89804	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/5z/cjztyn1s1rn3s2c69p59xt180000gn/T/vscode-typescript501/71051c709bca268ebe67/tscancellation-cc0023f27a481312d109.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc)
    0	    66	 89863	       electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /Users/nick/Library/Caches/typescript/5.1 --enableTelemetry --typesMapLocation /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation)
    0	   197	 89809	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=89772)
    0	   131	 89776	extensionHost [4]
    0	   131	 89800	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/5z/cjztyn1s1rn3s2c69p59xt180000gn/T/vscode-typescript501/e0f41dbc306372b98241/tscancellation-9db029f653aac6a5cc7f.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc)
    0	    66	 89801	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/5z/cjztyn1s1rn3s2c69p59xt180000gn/T/vscode-typescript501/e0f41dbc306372b98241/tscancellation-dd4d16e4515a9f8b1edf.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc)
    0	    66	 89836	       electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /Users/nick/Library/Caches/typescript/5.1 --enableTelemetry --typesMapLocation /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation)
    0	    66	 89805	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/html-language-features/server/dist/node/htmlServerMain --node-ipc --clientProcessId=89776)
    0	    66	 89814	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=89776)
    0	   131	 89777	extensionHost [1]
    0	   131	 89795	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/5z/cjztyn1s1rn3s2c69p59xt180000gn/T/vscode-typescript501/4650d6fbf84593e06f60/tscancellation-19793aee3506d98cd37e.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc)
    0	   131	 89796	     electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/5z/cjztyn1s1rn3s2c69p59xt180000gn/T/vscode-typescript501/4650d6fbf84593e06f60/tscancellation-88acdf713bb52dbadcd2.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc)
    0	    66	 89810	       electron-nodejs (/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /Users/nick/Library/Caches/typescript/5.1 --enableTelemetry --typesMapLocation /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation)
    0	    66	 89778	ptyHost
    0	     0	 89927	     /bin/zsh -il
    0	     0	 89948	     /bin/zsh -il
    0	     0	 90193	     /bin/zsh -il
    0	     0	 90783	     /bin/zsh -il
    0	     0	 90841	     /bin/zsh -il
    0	     0	 91375	     /bin/zsh -il
    0	     0	 91382	     /bin/zsh -il
    0	     0	 91389	     /bin/zsh -il
    0	   131	 89779	shared-process
    0	    66	 89780	fileWatcher [1]
    0	   131	 89781	extensionHost [3]
    0	    66	 89783	fileWatcher [4]
    0	    66	 89784	fileWatcher [2]
    0	    66	 89788	fileWatcher [3]

Workspace Stats: 
|  Window (worker.ts — spotify-queue-api)
|  Window (api.php — perfect-pixel-web)
|  Window (index.ts — perfect-pixel-event-classifier)
|  Window (index.ts — perfect-pixel-s-app)
|    Folder (spotify-queue-api): 9 files
|      File types: json(3) ts(2) prettierrc(1) toml(1)
|      Conf files: package.json(1) tsconfig.json(1)
|    Folder (perfect-pixel-event-classifier): 24 files
|      File types: json(6) js(5) map(5) ts(5)
|      Conf files: launch.json(1) package.json(1) tsconfig.json(1)
|      Launch Configs: node
|    Folder (perfect-pixel-s-app): 23 files
|      File types: json(4) DS_Store(2) md(2) toml(2) dockerignore(1) env(1)
|                  gitignore(1) npmrc(1) js(1) ts(1)
|      Conf files: package.json(2)
|    Folder (perfect-pixel-web): 15737 files
|      File types: php(11453) svg(476) md(413) json(211) stub(153) js(124)
|                  rst(37) yml(35) css(34) dist(28)
|      Conf files: package.json(8) dockerfile(7) makefile(1)
```