microsoft / vscode

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

`fileWatcher` keeps consuming CPU at 200%+ #226401

Closed u3u closed 1 month ago

u3u commented 2 months ago

Type: Performance Issue

I don't know under what circumstances this problem will occur. It will continue to occupy the CPU forever and will not stop unless I exit VSCode. I have already excluded unnecessary directories in the settings.

{
  "files.watcherExclude": {
    "**/.git": true,
    "**/.next": true,
    "**/node_modules": true,
    "**/public": true
  }
}

VS Code version: Code 1.92.2 (Universal) (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z) OS version: Darwin arm64 21.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 Max (10 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)|5, 5, 4| |Memory (System)|64.00GB (16.61GB free)| |Process Argv|--crash-reporter-id e876d160-74ec-48e3-b9c7-94af1b04941e| |Screen Reader|yes| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 18 393 2525 code main 6 131 2529 gpu-process 0 66 2530 utility-network-service 24 197 2631 shared-process 0 0 15087 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 66 2633 ptyHost 0 0 13673 zsh (figterm) 0 0 13714 zsh (qterm) 0 0 13747 /opt/homebrew/Cellar/zsh/5.9/bin/zsh --login 0 0 13674 zsh (figterm) 0 0 13705 zsh (qterm) 0 0 13754 /opt/homebrew/Cellar/zsh/5.9/bin/zsh --login 0 655 13622 window [3] (bought.js — logosc) 98 131 13665 fileWatcher [3] 1 328 13666 extensionHost [3] 0 131 13667 electron-nodejs (tsserver.js ) 0 459 13668 electron-nodejs (tsserver.js ) 0 459 13764 electron-nodejs (eslintServer.js ) 0 197 13788 electron-nodejs (tailwindServer.js ) 0 66 13798 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=13666 0 66 14040 /Users/qwq/.vscode/extensions/codeium.codeium-1.12.6/dist/380c7c9c022eebd0772a9eca3800839b5b4db78c/language_server_macos_arm --api_server_url https://server.codeium.com --manager_dir /var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/cf96a269-e828-454c-8e68-124975ac0b8a/codeium/manager --enable_chat_web_server --enable_lsp --inference_api_server_url https://inference.codeium.com --database_dir /Users/qwq/.codeium/database/9c0694567290725d9dcba14ade58e297 --enable_index_service --enable_local_search --search_max_workspace_file_count 5000 --indexed_files_retention_period_days 30 --workspace_id file_Users_qwq_dev_workspace_logosc --sentry_telemetry 0 590 14041 /Users/qwq/.vscode/extensions/codeium.codeium-1.12.6/dist/380c7c9c022eebd0772a9eca3800839b5b4db78c/language_server_macos_arm --api_server_url https://server.codeium.com --manager_dir /var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/cf96a269-e828-454c-8e68-124975ac0b8a/codeium/manager --enable_chat_web_server --enable_lsp --inference_api_server_url https://inference.codeium.com --database_dir /Users/qwq/.codeium/database/9c0694567290725d9dcba14ade58e297 --enable_index_service --enable_local_search --search_max_workspace_file_count 5000 --indexed_files_retention_period_days 30 --workspace_id file_Users_qwq_dev_workspace_logosc --sentry_telemetry --run_child --limit_go_max_procs 4 --random_port --random_port_dir=/var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/cf96a269-e828-454c-8e68-124975ac0b8a/codeium/manager/child_random_port_1724397056669253000_7892081773865867134 --manager_lock_file=/var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/cf96a269-e828-454c-8e68-124975ac0b8a/codeium/manager/locks/manager.lock --child_lock_file /var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/cf96a269-e828-454c-8e68-124975ac0b8a/codeium/manager/locks/child_lock_1724397056669338000_1271784498715716806 76 655 14143 window [4] (settings.json — ubrand (Workspace)) 100 131 14144 fileWatcher [4] 1 459 14145 extensionHost [4] 0 786 14265 electron-nodejs (eslintServer.js ) 0 66 14293 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=14145 0 66 14496 /Users/qwq/.vscode/extensions/codeium.codeium-1.12.6/dist/380c7c9c022eebd0772a9eca3800839b5b4db78c/language_server_macos_arm --api_server_url https://server.codeium.com --manager_dir /var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/ddd0447f-b5eb-479b-b44b-b8ec849f50eb/codeium/manager --enable_chat_web_server --enable_lsp --inference_api_server_url https://inference.codeium.com --database_dir /Users/qwq/.codeium/database/9c0694567290725d9dcba14ade58e297 --enable_index_service --enable_local_search --search_max_workspace_file_count 5000 --indexed_files_retention_period_days 30 --workspace_id file_Users_qwq_dev_workspace_ubrand_ubrand_code_workspace --sentry_telemetry 0 655 14497 /Users/qwq/.vscode/extensions/codeium.codeium-1.12.6/dist/380c7c9c022eebd0772a9eca3800839b5b4db78c/language_server_macos_arm --api_server_url https://server.codeium.com --manager_dir /var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/ddd0447f-b5eb-479b-b44b-b8ec849f50eb/codeium/manager --enable_chat_web_server --enable_lsp --inference_api_server_url https://inference.codeium.com --database_dir /Users/qwq/.codeium/database/9c0694567290725d9dcba14ade58e297 --enable_index_service --enable_local_search --search_max_workspace_file_count 5000 --indexed_files_retention_period_days 30 --workspace_id file_Users_qwq_dev_workspace_ubrand_ubrand_code_workspace --sentry_telemetry --run_child --limit_go_max_procs 4 --random_port --random_port_dir=/var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/ddd0447f-b5eb-479b-b44b-b8ec849f50eb/codeium/manager/child_random_port_1724397188099328000_1306348465916281579 --manager_lock_file=/var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/ddd0447f-b5eb-479b-b44b-b8ec849f50eb/codeium/manager/locks/manager.lock --child_lock_file /var/folders/66/1sgbzn213_s8s2bc6jfkb6000000gn/T/ddd0447f-b5eb-479b-b44b-b8ec849f50eb/codeium/manager/locks/child_lock_1724397188099395000_3484861061191402221 0 131 14498 electron-nodejs (tsserver.js ) 0 1114 14499 electron-nodejs (tsserver.js ) 0 524 14505 electron-nodejs (tailwindServer.js ) 1 131 15085 window [11] (Issue Reporter) ```
Workspace Info ``` | Window (settings.json — ubrand (Workspace)) | Window (bought.js — logosc) | Folder (ubrand): 14453 files | File types: js(2431) ts(2191) webp(1949) tsx(1830) svg(600) json(594) | png(458) gz(398) DS_Store(146) jpg(116) | Conf files: package.json(38) tsconfig.json(23) settings.json(9) | tasks.json(1) | Folder (admin): 699 files | File types: js(202) webp(95) tsx(51) ts(50) gz(43) json(30) svg(20) | pack(18) DS_Store(9) old(6) | Conf files: package.json(2) settings.json(1) tsconfig.json(1) | Folder (email-signature-generator): 1582 files | File types: js(692) json(203) png(180) webp(122) tsx(65) gz(44) ts(25) | svg(23) DS_Store(11) jpeg(10) | Conf files: package.json(3) settings.json(1) tsconfig.json(1) | Folder (web): 3351 files | File types: webp(855) tsx(372) js(255) ts(252) png(155) gz(126) | svg(104) DS_Store(44) jpg(41) json(25) | Conf files: package.json(2) settings.json(1) tsconfig.json(1) | Folder (gaitu): 2542 files | File types: ts(810) tsx(534) js(279) webp(142) png(81) jpg(57) json(46) | gz(39) svg(30) gif(27) | Conf files: package.json(2) settings.json(1) tsconfig.json(1) | Folder (gaitu-admin): 620 files | File types: js(245) webp(60) ts(52) json(38) gz(30) tsx(26) svg(19) | wasm(8) DS_Store(6) png(6) | Conf files: package.json(2) settings.json(1) tsconfig.json(1) | Folder (navi): 1393 files | File types: webp(356) ts(171) tsx(118) js(111) gz(39) svg(25) png(20) | json(16) wasm(8) DS_Store(7) | Conf files: package.json(2) tsconfig.json(1) | Folder (linktopia): 554 files | File types: ts(205) tsx(203) png(16) jpg(8) json(7) js(5) DS_Store(4) | svg(2) env(1) gitignore(1) | Conf files: settings.json(1) package.json(1) tsconfig.json(1) | Folder (linktopia-admin): 535 files | File types: js(232) ts(82) tsx(44) json(37) gz(22) svg(18) wasm(8) | DS_Store(6) pack(6) old(3) | Conf files: package.json(2) settings.json(1) tsconfig.json(1) | Folder (logo-ios-admin): 1327 files | File types: js(320) webp(319) ts(91) json(77) tsx(49) gz(30) svg(17) | DS_Store(10) wasm(8) old(3) | Conf files: package.json(2) settings.json(1) tsconfig.json(1) | Folder (api): 209 files | File types: ts(168) DS_Store(3) json(2) js(1) log(1) md(1) | Conf files: package.json(1) tsconfig.json(1) | Folder (daisyui): 50 files | File types: tsx(21) ts(3) DS_Store(2) json(2) js(2) md(1) | Conf files: package.json(1) tsconfig.json(1) | Folder (hooks): 44 files | File types: ts(36) json(2) DS_Store(1) js(1) log(1) md(1) | Conf files: package.json(1) tsconfig.json(1) | Folder (i18n): 76 files | File types: json(56) ts(5) js(3) DS_Store(2) tsx(2) log(1) md(1) | Conf files: package.json(1) tsconfig.json(1) | Folder (nextui): 20 files | File types: tsx(6) json(2) js(2) DS_Store(1) md(1) ts(1) | Conf files: package.json(1) tsconfig.json(1) | Folder (shared): 98 files | File types: ts(84) tsx(3) json(2) DS_Store(1) js(1) log(1) md(1) | Conf files: package.json(1) tsconfig.json(1) | Folder (ui): 370 files | File types: tsx(137) ts(105) DS_Store(11) js(3) svg(3) json(2) log(1) | md(1) css(1) | Conf files: package.json(1) tsconfig.json(1) | Folder (logosc): more than 32288 files | File types: php(5732) js(4270) png(1364) json(657) vue(638) jsx(593) | jpg(570) css(457) svg(456) dat(360) | Conf files: package.json(28) grunt.js(10) settings.json(5) makefile(4) | webpack.config.js(4) gulp.js(3) launch.json(1) | jsconfig.json(1) | Launch Configs: php; ```
Extensions (26) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 array-index-inlay|ant|0.4.0 vscode-tailwindcss|bra|0.12.6 package-json-upgrade|cod|3.0.1 codeium|Cod|1.12.6 vscode-eslint|dba|3.0.10 gitlens|eam|15.3.1 prettier-vscode|esb|11.0.0 comment-anchors|Exo|1.10.4 vscode-monorepo-workspace|fol|1.3.1 vscode-github-actions|git|0.26.3 vscode-env|Iro|0.1.0 svg|joc|1.5.4 i18n-ally|lok|2.12.0 json-to-ts|Mar|1.8.0 template-string-converter|meg|0.6.1 filename-snippets|nat|1.0.0 indent-rainbow|ode|8.3.1 material-icon-theme|PKi|5.9.0 vscode-thunder-client|ran|2.24.13 html-to-jsx|ria|0.0.1 sort-lines|Tyr|1.11.0 errorlens|use|3.20.0 fig|wit|0.0.7 pretty-ts-errors|Yoa|0.6.0 convert-object-to-jsx-vscode|zac|1.1.0 (2 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 f3je6385:31013174 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 newcmakeconfigv2:31071590 impr_priority:31102340 refactort:31108082 pythonrstrctxt:31112756 flightc:31119335 wkspc-onlycs-c:31111717 fje88620:31121564 ```
u3u commented 2 months ago
Xnip2024-08-23_15-19-36 image

It is still ongoing 😰

bpasero commented 2 months ago

Does it change if you set typescript.tsserver.experimental.useVsCodeWatcher to false?

u3u commented 2 months ago

Is there this option?! Let me try! These are my current tsserver settings:

{
  "typescript.tsserver.experimental.enableProjectDiagnostics": false,
  "typescript.tsserver.maxTsServerMemory": 9216,
}
bpasero commented 2 months ago

Yes, it is a setting in VSCode itself!

vs-code-engineering[bot] commented 2 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!

u3u commented 2 months ago

Okay, After disabling typescript.tsserver.experimental.useVsCodeWatcher, it has indeed not occurred again during this period.

bpasero commented 2 months ago

Is the repository where this reproduces something I can try on my machine, i.e. open source?

u3u commented 2 months ago

Sorry, this project is a company project and cannot be open-sourced. It is a large Monorepo project that includes several websites, public components, public utility packages, etc. I don't know the total number of files in this project, but most of them are .ts and .tsx files. There should be at least tens of thousands of .ts files 😓.

bpasero commented 1 month ago

ℹ I would appreciate if people impacted here could try out our latest insiders build (commit c4efe1dc9eec4914f3076b2d954fe4fe174a5820). It includes a change to reduce the pressure of file watching from the TypeScript extension.

Steps:

Happy to hear back how it goes 🙏

fabroce commented 2 weeks ago

I had this problem and since 1.94 no more CPU stress. Thanks.