microsoft / vscode

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

High cpu in tsserver extension for certain files #188717

Closed TimNZ closed 1 year ago

TimNZ commented 1 year ago

[Copied from vscode-typescript-next/issues]

I was experiencing this with VSCode built-in TS/JS, tried Nightly to see if it fixes and doesn't.

Attached tsserver log showing a geterr situation that seems stuck in a loop

If I close the files that are referenced in the tsserver log geterr chain, stuck loop ends and cpu usage drops.

Type: Performance Issue

Cannot provide any way to replicate this for you, it is specific to my project and a small number of files.

GroupHome.tsx is most obvious example

Extension version: 5.2.20230720 VS Code version: Code 1.80.1 (74f6148eb9ea00507ec113ec51c489d6ffb4b771, 2023-07-12T17:20:58.115Z) OS version: Darwin arm64 22.5.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 Pro (8 x 24)| |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| |Load (avg)|6, 6, 6| |Memory (System)|16.00GB (0.82GB free)| |Process Argv|--crash-reporter-id 16387210-b4f0-4540-9bd5-5d9084492a42| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 77 229 49317 code main 18 82 49322 gpu-process 0 16 49328 utility-network-service 0 115 49329 window [1] (AppStack - CollectionList.tsx) 0 229 49330 window [2] (Vouched - CheckboxLabelled.tsx) 69 524 49331 window [3] (Thrifty - tsserver.log) 0 66 49668 extensionHost [2] 0 0 49884 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230713/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/q8/7h62f8bd3zzff_5q1zd1521m0000gn/T/vscode-typescript501/296693d4742b9f32cd77/tscancellation-2e9b998d66f5660798c0.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc) 0 16 49898 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230713/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/q8/7h62f8bd3zzff_5q1zd1521m0000gn/T/vscode-typescript501/296693d4742b9f32cd77/tscancellation-6bbe3886e2e650145109.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc) 0 0 50627 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230713/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /Users/timshnaider/Library/Caches/typescript/5.2 --enableTelemetry --typesMapLocation /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230713/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation) 0 49 55361 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=49668) 0 16 49669 ptyHost 0 0 49676 /bin/zsh -il 0 0 49696 /bin/zsh -il 0 0 49720 /bin/zsh -il 0 0 49721 /bin/zsh -il 0 16 70496 node /opt/homebrew/Cellar/yarn/1.22.19/libexec/bin/yarn.js run thrifty-dev 0 16 70524 /Users/timshnaider/.nvm/versions/node/v18.12.1/bin/node /Users/timshnaider/development/audacious/projects/thrifty/source/packages/nextjsapp/node_modules/.bin/cross-env NODE_OPTIONS=--max_old_space_size=8192 --inspect --dns-result-order=ipv4first THISAPP_PLATFORM=thrifty THISAPP_STAGE=development next dev -p 3006 0 66 70526 /Users/timshnaider/.nvm/versions/node/v18.12.1/bin/node /Users/timshnaider/development/audacious/projects/thrifty/source/packages/nextjsapp/node_modules/.bin/next dev -p 3006 1 66 49670 shared-process 0 0 75778 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 16 49671 fileWatcher [2] 0 33 70315 fileWatcher [3] 10 246 70316 extensionHost [3] 0 33 70495 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=70316) 0 49 75265 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230720/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/q8/7h62f8bd3zzff_5q1zd1521m0000gn/T/vscode-typescript501/d24e15bee14692117ba4/tscancellation-23dc5beed01036c57485.tmp* --logVerbosity verbose --logFile /Users/timshnaider/Library/Application Support/Code/logs/20230714T131844/window3/exthost/vscode.typescript-language-features/tsserver-log-u1ZnSB/tsserver.log --traceDirectory /Users/timshnaider/Library/Application Support/Code/logs/20230714T131844/window3/exthost/vscode.typescript-language-features/tsserver-log-WlmAvi --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc) 92 852 75266 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node --max-old-space-size=3072 /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230720/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/q8/7h62f8bd3zzff_5q1zd1521m0000gn/T/vscode-typescript501/d24e15bee14692117ba4/tscancellation-fbb795557be07d5b97c9.tmp* --logVerbosity verbose --logFile /Users/timshnaider/Library/Application Support/Code/logs/20230714T131844/window3/exthost/vscode.typescript-language-features/tsserver-log-go8OUq/tsserver.log --traceDirectory /Users/timshnaider/Library/Application Support/Code/logs/20230714T131844/window3/exthost/vscode.typescript-language-features/tsserver-log-KvOR0k --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc) 0 33 75267 electron-nodejs (/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230720/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /Users/timshnaider/Library/Caches/typescript/5.2 --enableTelemetry --logFile /Users/timshnaider/Library/Application Support/Code/logs/20230714T131844/window3/exthost/vscode.typescript-language-features/tsserver-log-go8OUq/ti-75266.log --typesMapLocation /Users/timshnaider/.vscode/extensions/ms-vscode.vscode-typescript-next-5.2.20230720/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation) 2 98 75770 window [10] (Issue Reporter) 0 16 93063 fileWatcher [1] 0 33 93064 extensionHost [1] ```
Workspace Info ``` | Window (Thrifty - tsserver.log) | Window (Vouched - CheckboxLabelled.tsx) | Window (AppStack - CollectionList.tsx) | Folder (source): 1173 files | File types: tsx(399) js(156) json(108) pack(96) ts(58) woff2(35) | woff(33) svg(30) eot(15) ttf(15) | Conf files: package.json(7) settings.json(1) project.json(1) | jsconfig.json(1) tsconfig.json(1) | Folder (source): 1896 files | File types: js(544) tsx(502) pack(110) json(108) ts(76) woff2(49) | woff(47) svg(32) eot(29) ttf(29) | Conf files: package.json(8) jsconfig.json(2) tsconfig.json(2) | launch.json(1) settings.json(1) project.json(1) | Launch Configs: node(5) | Folder (source): 2094 files | File types: js(755) ts(430) map(360) tsx(209) json(46) md(6) css(4) | jpg(4) gitignore(3) zip(3) | Conf files: package.json(14) tsconfig.json(6) jsconfig.json(2) | launch.json(1) settings.json(1) tasks.json(1) | Launch Configs: pwa-node(2) node(2); ```
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 282f8724:30602487 f6dab269:30613381 showlangstatbar:30737416 vsctsb:30748421 03d35959:30757346 pythonfmttext:30731395 pythoncmv:30756943 fixshowwlkth:30771522 showindicator:30785052 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30779714 pythonidxpt:30784022 pythonnocebcf:30776496 e537b577:30795824 dsvsc013:30795093 cmakestatusbarv2:30779594 ```

tsserver-highcpu.zip

mjbvz commented 1 year ago

Does this reproduce in the latest VS Code insiders build with all extensions disabled?

TimNZ commented 1 year ago

Testing over the next 24 hrs, and will report tomorrow. Looking good so far.

TimNZ commented 1 year ago

I thought it was ok but still happening.


VS Code version: Code - Insiders 1.81.0-insider (Universal) (862fa13002d8018c328931ee1edccfd4ca76447d, 2023-07-26T05:36:43.574Z) OS version: Darwin arm64 22.5.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 Pro (8 x 24)| |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| |Load (avg)|7, 7, 6| |Memory (System)|16.00GB (0.08GB free)| |Process Argv|--crash-reporter-id b8e62bc8-9608-4575-8ab6-189467f44002| |Screen Reader|no| |VM|0%|
Extensions: none
A/B Experiments ``` vsliv695:30137379 vsins829:30139715 vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythontb:30258533 pythonptprofiler:30281269 vshan820:30294714 vscod805cf:30301675 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30404738 py29gd2263:30784851 vsclangdf:30492506 c4g48928:30535728 dsvsc012:30540252 pynewext54:30618038 showlangstatbar:30737417 7ij38806:30687742 pythonfmttext:30716741 pythoncmvfstr:30726892 fixshowwlkth:30771523 showindicator:30766888 pythongtdpath:30726887 i26e3531:30792625 gsofa:30797620 pythonnosmt12:30779711 pythonidxpt:30768918 pythonnoceb:30776497 copilotsettingt:30767686 e537b577:30772214 h0f32768:30792099 asynctokenver:30799129 dsvsc013:30777762 dsvsc014:30777825 cmakestatusbarv2:30779594 diffeditorv2:30786206 ```

This is info from VS Code Process Explorer - sitting at 100%

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/q8/7h62f8bd3zzff_5q1zd1521m0000gn/T/vscode-typescript501/c22bde530189d7aca58c/tscancellation-0c95156830f895bb6045.tmp* --logVerbosity verbose --logFile /Users/timshnaider/Library/Application Support/Code - Insiders/logs/20230727T122047/window1/exthost/vscode.typescript-language-features/tsserver-log-vPQSvb/tsserver.log --traceDirectory /Users/timshnaider/Library/Application Support/Code - Insiders/logs/20230727T122047/window1/exthost/vscode.typescript-language-features/tsserver-log-mplYIs --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc) 89 934 50350

vscodenpa commented 1 year ago

Hey @mjbvz, this issue might need further attention.

@TimNZ, you can help us out by closing this issue if the problem no longer exists, or adding more information.

vscodenpa commented 1 year 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!