vscode icon indicating copy to clipboard operation
vscode copied to clipboard

VS Code randomly freezes entire PC for a few seconds multiple times a day

Open goodspark opened this issue 3 years ago • 6 comments

Issue Type: Performance Issue

I'm not sure what the cause is yet or how to reliably recreate it.

Some info:

  • I'm running VS Code locally on my Windows 10 machine ~~but connected to a remote workspace with the remote SSH extension~~ (had this happen for a local workspace so I don't think the remote extension is at fault here).
  • I'm working in a large monorepo. I saw this also happen for a much smaller workspace, but currently I think a larger workspace is more likely to cause it.
  • This isn't CPU use - it looks like it's GPU related. I leave the task manager open all the time to see historical system resource usage and there's always a huge spike in GPU to 100% and then back down to normal levels (~2%, depending on what I'm doing).
  • I'm not doing anything workload intensive, as far as I know. Most of the time I notice this happening when I alt-tab back to VS Code and try to type in the built-in terminal. And the commands are simple, like 'git status' or 'll'. I've also had this happen by simply alt-tabbing back to VS Code and doing nothing else.
  • When the freeze happens, all keyboard/mouse input is ignored. The screen doesn't update. This lasts for a few seconds before everything works again.
  • I have a GeForce 1080 Ti graphics card on this machine and updated to the latest graphics drivers just in case.
  • It feels like this is a recent regression. Can't give a date, but feels like it maybe started ~2 months ago.

Version: 1.69.2 (user setup) (also seen on 1.69.0) Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a Date: 2022-07-18T16:12:52.460Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19044

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 x 4200)
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
Load (avg) undefined
Memory (System) 31.94GB (15.35GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote SSH: coder.asd
OS Linux x64 5.4.0-1068-gke
CPUs Intel(R) Xeon(R) CPU @ 3.10GHz (60 x 3100)
Memory (System) 236.15GB (118.82GB free)
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   111	 25100	code main
    0	    91	  5268	   extensionHost
    0	   220	 15872	   gpu-process
    0	    92	 16696	   issue-reporter
    0	   107	 20044	   shared-process
    0	    75	   364	     ptyHost
    0	     4	 19692	       C:\WINDOWS\System32\cmd.exe /c (type "C:\Users\sam\AppData\Local\Temp\vscode-linux-multi-line-command-coder.asd-819971363.sh" | ssh -T -D 55324 "coder.asd" bash) & exit /b 0
    0	     9	  5664	         ssh  -T -D 55324 "coder.asd" bash
    0	    46	 21108	           "C:\\Users\\myusername\\bin\\coder.exe" tunnel asd 12213 stdio
    0	     8	 20112	       console-window-host (Windows internal process)
    0	    69	 17100	     fileWatcher
    0	   307	 21932	   window (fish - myusername (Workspace) [SSH: coder.asd] - Visual Studio Code)
    0	    47	 25536	   utility-network-service

Remote: SSH: coder.asd
CPU %	Mem MB	   PID	Process
    0	     0	370447	remote agent
    0	     0	370485	   ptyHost
    0	     0	389928	     /usr/bin/fish
    0	     0	370511	   extensionHost
    0	     0	370547	     /home/myusername/.vscode-server/bin/92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9/node /home/myusername/.vscode-server/extensions/heptio.jsonnet-0.1.0/node_modules/vscode-languageclient/lib/utils/electronForkStart /home/myusername/.vscode-server/extensions/heptio.jsonnet-0.1.0/out/server/server.js --node-ipc --clientProcessId=370511
    0	     0	373002	     /home/myusername/go/bin/gopls -mode=stdio
    0	     0	373102	     /home/myusername/.vscode-server/extensions/hashicorp.terraform-2.23.0-linux-x64/bin/terraform-ls serve
    0	     0	373140	     /home/myusername/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1123-linux-x64/server/rust-analyzer
    0	     0	373440	       /home/myusername/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1123-linux-x64/server/rust-analyzer proc-macro
    0	     0	373144	     /home/myusername/.vscode-server/bin/92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9/node /home/myusername/.vscode-server/bin/92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=370511
    0	     0	373242	     /home/myusername/.vscode-server/bin/92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9/node /home/myusername/.vscode-server/extensions/ms-python.vscode-pylance-2022.7.20/dist/server.bundle.js --cancellationReceive=file:8dde805317c22445708c9a7ad0b86f86579eb8ea7c --node-ipc --clientProcessId=370511
    0	     0	370522	   fileWatcher
    0	     0	391533	   /bin/sh -c /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	     0	391534	     /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
Workspace Info

|  Remote: SSH: coder.asd;
Extensions (24)
Extension Author (truncated) Version
Nix bbe 1.0.1
postcss css 1.0.9
jupyter-keymap ms- 1.0.0
remote-ssh ms- 0.82.1
remote-ssh-edit ms- 0.80.0
remote-wsl ms- 0.66.3
vscode-bazel Baz 0.5.0
vscode-css-modules cli 0.4.2
vscode-eslint dba 2.2.6
vscode-deno den 3.13.0
gitlens eam 12.1.1
EditorConfig Edi 0.16.4
prettier-vscode esb 9.5.0
go gol 0.34.1
terraform has 2.23.0
jsonnet hep 0.1.0
elixir-ls Jak 0.10.0
python ms- 2022.10.0
vscode-pylance ms- 2022.7.20
jupyter ms- 2022.6.1001902341
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.8
rust-analyzer rus 0.3.1123
language-stylus sys 1.16.0

goodspark avatar Jul 12 '22 01:07 goodspark

Here's what system resources look like when this happens: image

goodspark avatar Jul 13 '22 00:07 goodspark

this is happening for a long time already, since ver ~1.48 or so . the freeze became longer some time ago .

i don't remember how, but i got a console/log report on this, as far i remember it said that OpenGL or something have hanged or crashed .

some Windows's UI also freeze while this is happening . that is a consequence of the VSC's issue, no other program causes that .

it seems related to large coverage of Open/Workspace Folders .

irvnriir avatar Jul 24 '22 00:07 irvnriir

might be related to https://github.com/microsoft/vscode/issues/152300

alexdima avatar Aug 03 '22 11:08 alexdima

It sounds very similar, but in my case, I rarely have more than 2-3 integrated terminals open at once.

goodspark avatar Aug 04 '22 23:08 goodspark

Just had this happen when I alt-tabbed back to a VS Code window (no other instances running) for a local workspace with a lot fewer files than the large mono repo I usually work in.

goodspark avatar Aug 07 '22 00:08 goodspark

@goodspark does the issue happen with latest stable 1.70.0 to rule out the terminal issue linked above. If the issue persists, can you check if starting the application with --disable-features=CalculateNativeWinOcclusion mitigates the hang. Thanks!

deepak1556 avatar Aug 10 '22 08:08 deepak1556

my issue does happen on 1.70.0 . though at the time it appeared, terminal was opened .

irvnriir avatar Aug 11 '22 17:08 irvnriir

Same, seeing it on 1.7.0. I'll try with the arg.

goodspark avatar Aug 11 '22 20:08 goodspark

with the param it happened relatively soon, without terminal ever opened since the start (but 1 console process was run without gui, by extension) .

irvnriir avatar Aug 11 '22 21:08 irvnriir

Also same after adding the startup arguments. I had 1 terminal open FWIW. Same symptoms. Display frozen, but audio still works (ex. if music was playing from another app).

goodspark avatar Aug 12 '22 02:08 goodspark

~~this often happens when i copy something to clipboard, but maybe that just makes me notice the freeze .~~

irvnriir avatar Aug 14 '22 03:08 irvnriir

Anything we can do to help debug this? Still an issue on 1.70.2.

goodspark avatar Aug 24 '22 20:08 goodspark

also, my system which has the issue uses 2ndary Intel graphics processor which doesn't have drivers newer than from 2015 year . (in case you rely on some functionality which wasn't supported until some version)

irvnriir avatar Sep 10 '22 06:09 irvnriir

@goodspark are you sure that your Nvid. GPU is used for processing VSC / do you have the latest drivers for all GPUs/"display adapters" which is involved in providing you the GUI ?

irvnriir avatar Sep 12 '22 05:09 irvnriir

I'm think so. My monitor is plugged into the graphics card output and nothing else is plugged into the motherboard video out. And I open the task manager in Windows, there's only one section for GPU and it lists the Nvidia card as the hardware.

goodspark avatar Sep 13 '22 02:09 goodspark

Hm. An interesting data point - it seems like this doesn't happen if I don't have Chromium running. Or at least, it doesn't happen as often. Left VSCode open over the weekend after closing Chromium and haven't seen this happen yet. Could it be an Electron thing? At the same time, I'm also using the Discord desktop client, which also uses Electron.

goodspark avatar Sep 19 '22 04:09 goodspark

i also often have browser open .

after i work for some time, 2-5 second freezes start to happen about every 10 minutes or less, can anyone whos responsible for the relevant parts of VSC imagine having that every time ?

irvnriir avatar Sep 19 '22 08:09 irvnriir

this issue still has "info-needed" tag, whyyyyy ??? we wasn't provided a single bit of info about what info to send .

irvnriir avatar Sep 19 '22 08:09 irvnriir

Do you use Chromium or Chrome? Also, yes, it'd be nice to know if there's any more diagnostic or debugging information we can provide to help figure out what's going on.

goodspark avatar Sep 19 '22 08:09 goodspark

@goodspark i use Firefox, i assume its already far from Chromium .

also, there is no Extension which we both use .

irvnriir avatar Sep 19 '22 08:09 irvnriir

OK so I left the dev tools open for VSCode in the hopes of capturing a profile whenever I tabbed back into VSCode after a long break. I got lucky and finally captured a trace when the freeze happened (attached): Profile-20220919T212500 - Copy.zip

You can view this in Chromium/Chrome/VSCode dev tools by going to the performance tab and clicking the icon to load the profile. The pause happened at ~23s into the trace. There's a 9s red block that says 'dropped frame'. That roughly lines up with the timing of the delay I saw on my machine.

Notable data:

  • There's a huge stack of animations occuring just before the red dropped frame block: https://user-images.githubusercontent.com/29210237/191169235-8ad04038-09c6-492a-98e4-e0be967e87d0.mp4
  • Nothing sticks out as bad in the captured function calls.
  • There are two long blocks of GPU activity during the dropped frame: image

Hopefully this helps. I'm at a loss as to what other data we can provide the VSCode maintainers to help debug this issue. There's been a lot of silence.

goodspark avatar Sep 20 '22 04:09 goodspark

Sorry for the delay here, please check if the issue still happens with latest insiders https://code.visualstudio.com/insiders and if it does capture the trace using the steps below,

  1. Closing all running instances of VSCode Insiders
  2. Start a new instance with the following arguments from the system terminal code-insiders --trace --trace-category-filter="base,benchmark,browser,latency,mojom,content,startup,toplevel,v8,navigation,disabled-by-default-lifecycles,blink,cc,gpu,viz"
  3. Perform the steps to repro the gpu spike, open command palette and run Developer: Stop Tracing, this will generate a trace and provide you the path at which the trace was saved. Attach it to this issue thread.

deepak1556 avatar Dec 15 '23 16:12 deepak1556

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!

vscodenpa avatar Dec 23 '23 11:12 vscodenpa