microsoft / vscode

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

JS/TS Language Service repeatedly crashing #202894

Closed mjbyrnes4664 closed 8 months ago

mjbyrnes4664 commented 9 months ago

Type: Bug

I'm experiencing an issue with the JS/TS language service. The service is continually reloading and crashing rendering its features unusable. This service is expected to run silently in the background and provide intellisense for JS/TS files.

I have tried disabling all extensions and still see the issue.

Steps to reproduce

  1. Open VS Code with a typescript project
  2. Open a typescript file.
  3. Notice the JS/TS language features load and intellisense works
  4. Open a few more TS files
  5. Switch between the open TS files
  6. Notice the "Initializing JS/TS language features" is continually spinning in the bottom bar
  7. Notice Intellisense will no longer work
  8. Notice the pop up warning stating JS/TS language service has crashed 5 times

Versions

VS Code - 1.85.2 Node - 18.18.2 Typescript - 4.7.4

I have my project configured to use the workspace TS version, but also saw the issue when using VS Code's version (5.3.2)

Sample from the logs

2024-01-19 14:31:15.673 [info] TSServer log file: /Users/username/Library/Application Support/Code/logs/20240119T113236/window1/exthost/vscode.typescript-language-features/tsserver-log-1d6Bbx/tsserver.log undefined
2024-01-19 14:31:15.673 [info] Starting TS Server undefined
2024-01-19 14:31:15.673 [info] Using tsserver from: /Users/username/src/projectname/node_modules/typescript/lib/tsserver.js undefined
2024-01-19 14:31:15.673 [info] Using Node installation from /Users/username/.nvm/versions/node/v18.18.2/bin/node to run TS Server undefined
2024-01-19 14:31:15.673 [info] <syntax> Log file: /Users/username/Library/Application Support/Code/logs/20240119T113236/window1/exthost/vscode.typescript-language-features/tsserver-log-1otzPt/tsserver.log
2024-01-19 14:31:15.673 [info] <syntax> Forking...
2024-01-19 14:31:15.673 [info] <syntax> Starting...
2024-01-19 14:31:15.673 [info] <semantic> Log file: /Users/username/Library/Application Support/Code/logs/20240119T113236/window1/exthost/vscode.typescript-language-features/tsserver-log-ArVKlv/tsserver.log
2024-01-19 14:31:15.673 [info] <semantic> Forking...
2024-01-19 14:31:15.673 [info] <semantic> Starting...
2024-01-19 14:31:39.061 [error] TSServer exited. Code: null. Signal: SIGABRT

VS Code version: Code 1.85.2 (Universal) (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:32.531Z) OS version: Darwin arm64 23.2.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 Max (10 x 24)| |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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|4, 6, 6| |Memory (System)|64.00GB (15.34GB free)| |Process Argv|--crash-reporter-id f22b4b61-07bb-411f-947b-f6b8f8d65bb9| |Screen Reader|no| |VM|0%|
Extensions (17) Extension|Author (truncated)|Version ---|---|--- vscode-apollo|apo|1.20.0 vscode-tailwindcss|bra|0.10.5 vscode-eslint|dba|2.4.2 es7-react-js-snippets|dsz|4.4.3 gitlens|eam|14.7.0 prettier-vscode|esb|10.1.0 vscode-codeowners|jas|1.1.1 vscode-docker|ms-|1.28.0 playwright|ms-|1.0.21 remote-containers|ms-|0.327.0 live-server|ms-|0.4.13 makefile-tools|ms-|0.8.22 vscode-versionlens|pfl|1.9.2 vscode-coverage-gutters|rya|2.11.1 vscode-stylelint|sty|1.3.0 tiltfile|til|0.0.3 pretty-ts-errors|Yoa|0.5.3
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 vsclangdf:30486550 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30933248 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 dsvsc019a:30933241 ```
mjbyrnes4664 commented 9 months ago

Looks like the issue is due to the size of the project I have. I may have fixed it by giving tsserver more memory. Will report back next week with results. So far it's looks good

In settings.json

// 8GB of memory
"typescript.tsserver.maxTsServerMemory": 8192,
// custom node installation to allow more than 4GB memory
"typescript.tsserver.nodePath": "node",

image

Ttou commented 9 months ago

same problem

image
digitalmaster commented 8 months ago

Hmm. same issue

image
Ttou commented 8 months ago

@digitalmaster in my case, the extension CodeGeeX cause this issue, you can check your installed extensions

mjbvz commented 8 months ago

From the logs, it looks like a memory usage issue. This can sometimes happen for very large projects. If your project isn't that large though and is still causing this crash, please open a new issue against typescript so we can investigate

Switching to use your own node version is the right workaround here as unfortunately our built-in node version is limited in how much memory it can use

digitalmaster commented 8 months ago

For me the issue went away by just setting the workspace version: CleanShot 2024-02-08 at 17 31 00@2x