microsoft / vscode

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

Unresponsive with zombie sh child processes #167320

Closed sim642 closed 10 months ago

sim642 commented 1 year ago

Type: Performance Issue

Recently it has become quite frequent that VSCode is very unresponsive (not finding files, not doing git operations, etc) while "idling" at 50%-100% CPU usage. I have noticed that every time this happens, VSCode has a bunch of zombie sh child processes that come and go. During git operations also zombie git child processes. Clearly, it is really stuck doing something that it cannot even handle and wait its child processes.

By the way, VSCode UI is not frozen during this: loading bars still animate, etc.

VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T03:54:53.913Z) OS version: Linux x64 5.15.0-46-generic Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 2800)| |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: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|3, 4, 2| |Memory (System)|30.59GB (12.30GB free)| |Process Argv|. --crash-reporter-id 24f060cb-acb5-4d97-8ff4-c0901728f659| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|xubuntu| |XDG_CURRENT_DESKTOP|XFCE| |XDG_SESSION_DESKTOP|xubuntu| |XDG_SESSION_TYPE|x11|
Process Info ``` CPU % Mem MB PID Process 0 125 1353105 code main 0 31 1353121 zygote 0 125 1353152 gpu-process 0 31 1353122 zygote 0 0 1353124 zygote 0 63 1395097 issue-reporter 0 63 1353180 utility-network-service 0 282 1353236 window (goblint_backtrace.ml - goblint - Visual Studio Code) 0 125 1353262 shared-process 0 63 1353283 ptyHost 0 0 1353490 /usr/bin/bash --init-file /usr/share/code/resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh 0 125 1353343 fileWatcher 0 0 1395378 /bin/sh -c /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 0 1395379 /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 3 219 1353282 extensionHost 0 877 1353453 ocamllsp 0 0 1354319 /home/simmo/dev/goblint/sv-comp/goblint/_opam/bin/dune ocaml-merlin --no-print-directory 0 63 1353575 /usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=1353282 0 0 1395361 [sh] 0 0 1395363 [sh] 0 0 1395365 [sh] 0 0 1395367 [sh] 0 0 1395369 [sh] 0 0 1395371 [sh] 0 0 1395373 [sh] 0 0 1395377 [sh] ```
Workspace Info ``` | Window (goblint_backtrace.ml - goblint - Visual Studio Code) | Folder (goblint): more than 21301 files | File types: ml(1859) o(1836) c(1538) h(1113) cmi(994) node(965) | cmx(915) cmt(903) cpp(894) d(757) | Conf files: makefile(39) package.json(21) cmake(11) github-actions(7) | csproj(4) dockerfile(3) settings.json(3) | webpack.config.js(3) devcontainer.json(1) launch.json(1) | sln(1) | Launch Configs: ocamlearlybird; ```
Extensions (27) Extension|Author (truncated)|Version ---|---|--- xml|Dot|2.5.1 gitlens|eam|13.1.1 gc-excelviewer|Gra|4.2.56 todo-tree|Gru|0.0.220 cmake-language-support-vscode|jos|0.0.7 intellij-idea-keybindings|k--|1.5.4 rainbow-csv|mec|3.3.0 vscode-docker|ms-|1.22.2 vscode-dotnet-runtime|ms-|1.6.0 isort|ms-|2022.8.0 python|ms-|2022.18.2 vscode-pylance|ms-|2022.11.30 sarif-viewer|MS-|3.3.3 remote-containers|ms-|0.262.3 remote-ssh|ms-|0.92.0 remote-ssh-edit|ms-|0.84.0 remote-wsl|ms-|0.72.0 vscode-remote-extensionpack|ms-|0.23.0 cmake-tools|ms-|1.12.27 remote-explorer|ms-|0.0.2 vsliveshare|ms-|1.0.5776 vsliveshare-audio|ms-|0.1.91 vsliveshare-pack|ms-|0.4.0 ocaml-platform|oca|1.11.0 vscode-commons|red|0.0.6 vscode-xml|red|0.22.0 cmake|twx|0.0.17
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012cf:30540253 azure-dev_surveyone:30548225 vsccc:30610678 pyindex848cf:30577861 nodejswelcome1:30587005 3biah626:30602489 gswce1:30612156 iaj6b796:30613358 dbltrim-noruby:30604474 89544117:30613380 ```
lszomoru commented 1 year ago

@deepak1556, could you please advise on what information should be collected to further troubleshoot this? Thanks!

sim642 commented 1 year ago

Out of curiosity I looked into the developer tools and noticed tons of unresponsive extension host warnings. Seems like it might be the fault of one extension (https://github.com/Gruntfuggly/todo-tree/issues/621#issuecomment-1341099401, https://github.com/Gruntfuggly/todo-tree/issues/495, https://github.com/Gruntfuggly/todo-tree/issues/433).

I find it surprising, though, that a misbehaving extension in an isolated process is able to prevent core functionality like "Go to file" from working.

berndporr commented 1 year ago

I'm having the same problem. I'm using a server together with @ireneluna22 who's been using vscode yesterday and logged out. Still there are a bunch of zombie processes:

irene 1181563 0.0 0.0 33774844 14104 ? S Dec13 0:00 /usr/share/code/code --type=zygote --no-zygote-s irene 1181564 0.0 0.0 33774832 20324 ? S Dec13 0:00 /usr/share/code/code --type=zygote --enable-cras irene 1181566 0.0 0.0 33774856 9540 ? S Dec13 0:00 /usr/share/code/code --type=zygote --enable-cras irene 1181659 0.0 0.1 33832376 28824 ? Sl Dec13 0:03 /usr/share/code/code --type=utility --utility-su irene 1181701 0.0 0.4 52962808 103244 ? Sl Dec13 0:26 /usr/share/code/code --type=renderer --enable-cr irene 1181851 0.0 0.1 33975988 27224 ? Sl Dec13 0:01 /usr/share/code/code --type=gpu-process --enable irene 1181947 0.0 0.2 46670468 72712 ? Sl Dec13 0:19 /usr/share/code/code --type=renderer --enable-cr irene 1181974 0.0 0.1 38179996 48188 ? Sl Dec13 0:20 /usr/share/code/code --ms-enable-electron-run-as irene 1182027 0.0 0.1 38171780 33368 ? Sl Dec13 0:04 /usr/share/code/code --ms-enable-electron-run-as irene 1182052 0.0 0.1 38171716 31636 ? Sl Dec13 0:02 /usr/share/code/code --ms-enable-electron-run-as

When I logged in there was an vscode process running at 200% CPU (from my last login) which I killed. We both work via ssh. She directly does ssh -X with X forwarding (Irene, can you confirm) and I start vscode locally and then use the remote ssh edit.

vscode 1.74.0-1670 x64 as updated via the vscode on ubuntu 22.04.1 LTS which is installed on all of our computers.

ireneluna22 commented 1 year ago
Hi, Yes. I confirm I always do ssh -X.  Regards, Irene From: Bernd PorrSent: Wednesday, December 14, 2022 8:07 PMTo: microsoft/vscodeCc: ireneluna22; MentionSubject: Re: [microsoft/vscode] Unresponsive with zombie sh child processes (Issue #167320) I'm having the same problem. I'm using a server together with @ireneluna22 who's been using vscode yesterday and logged out. Still there are a bunch of zombie processes:irene 1181563 0.0 0.0 33774844 14104 ? S Dec13 0:00 /usr/share/code/code --type=zygote --no-zygote-sirene 1181564 0.0 0.0 33774832 20324 ? S Dec13 0:00 /usr/share/code/code --type=zygote --enable-crasirene 1181566 0.0 0.0 33774856 9540 ? S Dec13 0:00 /usr/share/code/code --type=zygote --enable-crasirene 1181659 0.0 0.1 33832376 28824 ? Sl Dec13 0:03 /usr/share/code/code --type=utility --utility-suirene 1181701 0.0 0.4 52962808 103244 ? Sl Dec13 0:26 /usr/share/code/code --type=renderer --enable-crirene 1181851 0.0 0.1 33975988 27224 ? Sl Dec13 0:01 /usr/share/code/code --type=gpu-process --enableirene 1181947 0.0 0.2 46670468 72712 ? Sl Dec13 0:19 /usr/share/code/code --type=renderer --enable-crirene 1181974 0.0 0.1 38179996 48188 ? Sl Dec13 0:20 /usr/share/code/code --ms-enable-electron-run-asirene 1182027 0.0 0.1 38171780 33368 ? Sl Dec13 0:04 /usr/share/code/code --ms-enable-electron-run-asirene 1182052 0.0 0.1 38171716 31636 ? Sl Dec13 0:02 /usr/share/code/code --ms-enable-electron-run-asWhen I logged in there was an vscode process running at 200% CPU which I killed. We both work via ssh. She directly does ssh -X with X forwarding (Irene, can you confirm) and I start vscode locally and then use the remote edit.vscode 1.74.0-1670 as updated via the vscode on ubuntu 22.04.1 LTS which is installed on all of our computers.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***> 
deepak1556 commented 1 year ago

@sim642 can you follow the steps in https://github.com/microsoft/vscode/wiki/Performance-Issues#profile-the-running-extensions and attach the profile in this issue thread. Additionally, based on https://github.com/microsoft/vscode/issues/167320#issuecomment-1341107388 can you perform an extension bisect from the command palette with Help: Start extension bisect to help identify if an extension is causing this issue. Thanks!

deepak1556 commented 1 year ago

@berndporr from https://github.com/microsoft/vscode/issues/167320#issuecomment-1351998937 I don't see any zombie process, how did you confirm them ?

When I logged in there was an vscode process running at 200% CPU (from my last login) which I killed

Can you provide the command line of this process ?

Side note, for your use case maybe our remote tunnels feature https://code.visualstudio.com/docs/remote/tunnels#_getting-started is a better alternative than x11 forwarding.

berndporr commented 1 year ago

Sorry I didn't log mine properly as I was in a hurry but a day later when I logged in there was a 100% process running by @ireneluna22 but she had logged out by that time. Irene, do you remember if you were in via "ssh -X" or via code's "remote ssh"?

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND

2929896 irene 20 0 32.4g 76720 51504 R 99.7 0.3 3618:55 code 2932121 irene 20 0 36.4g 77536 60008 S 0.3 0.3 0:04.72 code

Either way these leftover processes have been a pain for more than a year and for me the reason to revert back to emacs as working on a shared server is really a pain.

berndporr commented 1 year ago

@deepak1556 I for my part don't do X forwarding anymore and neither Irene now. I had a look at the tunnel and that looks like a super complex alternative which I don't have the time to look into. We both use "remote ssh" and that's the also the way I'm working with my raspberry pis. Why doing another workaround when there are probably again other issues? That really needs to be fixed. Our workaround is now much simpler: killall code before logging out. Sad, but it works! And sorry I don't have time to do deeper debugging at the moment.

deepak1556 commented 1 year ago

Just to clarify, you are seeing these long running processes on your server (not on the client ?) when running with remote ssh ? Can you provide the full command line of these processes next time the issue happens ?

berndporr commented 1 year ago

Yes. The long running processes are where our python code is being edited remotely so on the server and where "code" runs its server. The only commandline is "code" on the client ( a laptop ). Then clicking on remote ssh within "code" and editing remotely python scripts on the server. On the remote server these zomie processes keep running even after the client has logged out.On 20 Dec 2022 11:55, Robo @.***> wrote: Just to clarify, you are seeing these long running processes on your server (not on the client ?) when running with remote ssh ? Can you provide the full command line of these processes next time the issue happens ?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

deepak1556 commented 1 year ago

Can you provide the output of ps -p <PID> -o state,%cpu,args -ww, replace <PID> with process ids of the long running process on the remote server.

deepak1556 commented 10 months ago

Closing due to inactivity.