microsoft / vscode

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

terminal.integrated.shellIntegration.enabled causes terminal to become progressively unresponsive #232234

Open ogrisel opened 1 day ago

ogrisel commented 1 day ago

Type: Performance Issue

Observed: the cursor progresses very slowly to the left and becomes almost stuck with very high CPU usage when holding the backspace key.

Workaround: setting terminal.integrated.shellIntegration.enabled to false, and starting a new zsh shell (even without terminating the previous shell) makes the terminal responsive again.

I am using the zsh shell with some custom prompt and other zsh custom config.

I found about the culprit in this stackoverlow answer: https://stackoverflow.com/a/78624068/163740

VS Code version: Code 1.94.2 (Universal) (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z) OS version: Darwin arm64 23.5.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|7, 8, 9| |Memory (System)|16.00GB (0.04GB free)| |Process Argv|--crash-reporter-id a9b46850-8582-479a-9ccf-67c15c22fa0a| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 4 115 96110 code main 0 49 96114 gpu-process 0 33 96115 utility-network-service 0 131 96116 window [1] (Settings — scikit-learn) 0 49 96141 ptyHost 0 0 96199 /bin/zsh -i 0 0 96428 /bin/zsh -i 0 0 96508 /bin/zsh -il 0 0 96697 /bin/zsh -il 0 0 97377 /bin/zsh -i 0 0 97749 /bin/zsh -i 0 66 96142 extensionHost [1] 0 0 96151 /Users/ogrisel/.vscode/extensions/ms-python.python-2024.16.1-darwin-arm64/python-env-tools/bin/pet server 0 0 96160 /Users/ogrisel/miniforge3/envs/dev/bin/python /Users/ogrisel/.vscode/extensions/ms-python.black-formatter-2024.4.0/bundled/tool/lsp_server.py --stdio 0 0 96178 /Users/ogrisel/.vscode/extensions/ms-vscode.cpptools-1.22.10-darwin-arm64/bin/cpptools 0 49 96205 electron-nodejs (bundle.js ) 0 33 96269 electron-nodejs (server-node.js ) 0 49 96189 shared-process 0 0 98803 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 49 96191 fileWatcher [1] ```
Workspace Info ``` | Window (Settings — scikit-learn) | Folder (scikit-learn): 6642 files | File types: json(1199) py(987) rst(865) o(288) so(272) dep(272) c(215) | png(170) pyx(113) new(111) | Conf files: github-actions(17) makefile(4) settings.json(1); ```
Extensions (34) Extension|Author (truncated)|Version ---|---|--- ruff|cha|2024.52.0 copilot|Git|1.242.0 copilot-chat|Git|0.21.2 vscode-github-actions|git|0.27.0 vscode-cython|ktn|1.0.3 vscode-pdf|mat|0.0.6 black-formatter|ms-|2024.4.0 debugpy|ms-|2024.12.0 python|ms-|2024.16.1 vscode-pylance|ms-|2024.10.1 datawrangler|ms-|1.12.0 jupyter|ms-|2024.9.1 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.388.0 remote-ssh|ms-|0.115.0 remote-ssh-edit|ms-|0.87.0 remote-wsl|ms-|0.88.4 vscode-remote-extensionpack|ms-|0.26.0 cmake-tools|ms-|1.19.52 cpptools|ms-|1.22.10 cpptools-extension-pack|ms-|1.3.0 makefile-tools|ms-|0.11.13 remote-explorer|ms-|0.4.3 remote-server|ms-|1.5.2 vscode-speech|ms-|0.10.0 vsliveshare|ms-|1.0.5941 vscode-xml|red|0.27.1 rust-analyzer|rus|0.3.2154 rewrap|stk|1.16.3 even-better-toml|tam|0.19.2 cmake|twx|0.0.17 (1 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 9c06g630:31013171 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31102340 nativerepl1:31139838 refactort:31108082 pythonrstrctxt:31112756 wkspc-onlycs-t:31132770 wkspc-ranged-t:31151552 cf971741:31144450 defaultse:31146405 iacca2:31156134 notype1:31157159 5fd0e150:31155592 dwcopilot:31164048 iconenabled:31158251 ```
ogrisel commented 3 hours ago

@Tyriar let me know if you cannot reproduce and want me to run some command to profile what's CPU intensive in the terminal when this happens.

The "Code Helper (rendered)" process seems to be the one lagging according to Activity Monitor (on macOS). Here is a sample when this happens (without symbols).

Sample of Code Helper (Renderer).txt