microsoft / vscode

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

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

Closed goodspark closed 9 months ago

goodspark commented 2 years ago

Issue Type: Performance Issue

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

Some info:

Version: 1.71.0 (user setup) Commit: 784b0177c56c607789f9638da7b6bf3230d47a8c Date: 2022-09-01T07:36:10.600Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Windows_NT x64 10.0.19044 Sandboxed: No

Also seen on 1.70.2, 1.69.2, 1.69.0, 1.64.2

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 commented 2 years ago

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

irvnriir commented 2 years ago

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 .

alexdima commented 2 years ago

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

goodspark commented 2 years ago

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

goodspark commented 2 years ago

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.

deepak1556 commented 2 years ago

@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!

irvnriir commented 2 years ago

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

goodspark commented 2 years ago

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

irvnriir commented 2 years ago

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

goodspark commented 2 years ago

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).

irvnriir commented 2 years ago

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

goodspark commented 2 years ago

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

irvnriir commented 2 years ago

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 commented 2 years ago

@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 ?

goodspark commented 2 years ago

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 commented 2 years ago

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.

irvnriir commented 2 years ago

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 commented 2 years ago

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

goodspark commented 2 years ago

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.

irvnriir commented 2 years ago

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

also, there is no Extension which we both use .

goodspark commented 2 years ago

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:

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.

deepak1556 commented 10 months ago

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.

vscodenpa commented 9 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!