microsoft / vscode

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

TypeScript Server v5.6.2 on WSL continually crashes after Sept update #230458

Open mcalligator opened 1 month ago

mcalligator commented 1 month ago

Type: Bug

Along with the automatic VSCode update to the September 2024 version, TypeScript was also updated to v5.6.2 (from v5.5.4).

When I open any .ts file, the TypeScript server fails to start successfully - it keeps attempting to restart. Relevant log output:

2024-10-04 05:17:39.408 [info] Starting TS Server
2024-10-04 05:17:39.408 [info] Using tsserver from: /home/angus/.vscode-server/bin/d78a74bcdfad14d5d3b1b782f87255d802b57511/extensions/node_modules/typescript/lib/tsserver.js
2024-10-04 05:17:39.408 [info] <syntax> Forking...
2024-10-04 05:17:39.408 [info] <syntax> Starting...
2024-10-04 05:17:39.408 [info] <semantic> Forking...
2024-10-04 05:17:39.408 [info] <semantic> Starting...
2024-10-04 05:19:12.476 [error] TSServer exited. Code: null. Signal: SIGABRT
2024-10-04 05:19:12.479 [info] Starting TS Server

Potentially relevant:

VS Code version: Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z) OS version: Windows_NT x64 10.0.22631 Modes: Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 5700U with Radeon Graphics (16 x 1797)| |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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|15.33GB (1.90GB free)| |Process Argv|--folder-uri=vscode-remote://wsl+Arch/home/angus/Projects/document-translation --remote=wsl+Arch --crash-reporter-id f5145f28-da05-4674-b730-734fa53a491b| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Arch| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|AMD Ryzen 7 5700U with Radeon Graphics (16 x 0)| |Memory (System)|7.42GB (3.90GB free)| |VM|0%|
Extensions (6) Extension|Author (truncated)|Version ---|---|--- remote-wsl|ms-|0.88.4 amazon-q-vscode|ama|1.28.0 aws-toolkit-vscode|ama|3.27.0 vscode-eslint|dba|3.0.10 prettier-vscode|esb|11.0.0 vscode-yaml|red|1.15.0
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 vscaat:30438848 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 945dj816:31013170 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 impr_priority:31102340 nativerepl2:31139839 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31134774 wkspc-onlycs-t:31132770 wkspc-ranged-t:31151552 cf971741:31144450 defaultse:31146405 iacca1:31150322 notype1cf:31151524 5fd0e150:31146321 ```
mjbvz commented 1 month ago

Please try collecting the TS Server log from the crashed instance:

  1. Set "typescript.tsserver.log": "verbose"
  2. Restart VS Code and reproduce the problem
  3. Open the TypeScript section of the output panel
  4. At the very top, find the first line that prints to path to the semantic error log file. It should look something like:

    [Info  - 19:54:59.247] <semantic> Log file: /Users/matb/Library/Application Support/Code - Insiders/logs/20200213T104930/exthost55/vscode.typescript-language-features/tsserver-log-ZT2zau/tsserver.log

    That file contains the typescript logs.

Look through that log file for the first error or stack trace you see. If you can share the log, I can also take a look to see if anything stands out

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

mcalligator commented 1 month ago

Thanks @mjbvz for your reply. I've done as advised, though I'm sparing you the entire TypeScript semantic log file here, as it's nearly 46,000 lines long. I looked through it to try and establish just why it was so big, and discovered the vast majority of entries related to creating FileWatchers to the contents of the various node_modules directories within the repo.

What made the problem worse (in retrospect) was my initial attempts to troubleshoot it: I renamed the node_modules directories and re-ran npm install to clean things up (adding those renamed directories to .gitignore). It seems that the TypeScript server then included these in its set of watched files, which probably made bad things happen (not that I identified anything specific in the log file, though).

When I deleted the copies of node_modules and restarted VSCode, the issue seemed to disappear. I'm not 100% convinced that the copies of node_modules was the original cause, however, since the problem occurred before I created those copies. But since it's now gone away, I think I'll just keep an eye on it and flag it again if it recurs.

Here's the first bit of the semantic log, in case there's anything noteworthy:

Info 0    [22:17:14.088] Starting TS Server
Info 1    [22:17:14.088] Version: 5.6.2
Info 2    [22:17:14.088] Arguments: /home/angus/.vscode-server/bin/d78a74bcdfad14d5d3b1b782f87255d802b57511/node /home/angus/.vscode-server/bin/d78a74bcdfad14d5d3b1b782f87255d802b57511/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /tmp/vscode-typescript1000/937e42fe6044315f8a35/tscancellation-b42afe3fca12ffad47c9.tmp* --logVerbosity verbose --logFile /home/angus/.vscode-server/data/logs/20241006T221711/exthost1/vscode.typescript-language-features/tsserver-log-bPACNM/tsserver.log --locale en --noGetErrOnBackgroundUpdate --canUseWatchEvents --validateDefaultNpmLocation --useNodeIpc
Info 3    [22:17:14.088] Platform: linux NodeVersion: v20.16.0 CaseSensitive: true
Info 4    [22:17:14.089] ServerMode: undefined hasUnknownServerMode: undefined
Info 5    [22:17:14.099] Binding...
Info 6    [22:17:14.108] request:
    {
      "seq": 0,
      "type": "request",
      "command": "configure",
      "arguments": {
        "hostInfo": "vscode",
        "preferences": {
          "providePrefixAndSuffixTextForRename": true,
          "allowRenameOfImportPath": true,
          "includePackageJsonAutoImports": "auto",
          "excludeLibrarySymbolsInNavTo": true
        },
        "watchOptions": {}
      }
    }
Info 7    [22:17:14.108] Host information vscode
Info 8    [22:17:14.108] Host watch options changed to undefined, it will be take effect for next watches.
Info 9    [22:17:14.109] response:
    {"seq":0,"type":"response","command":"configure","request_seq":0,"success":true}
Perf 10   [22:17:14.110] 0::configure: async elapsed time (in milliseconds) 2.0951
Info 11   [22:17:14.110] request:
    {
      "seq": 1,
      "type": "request",
      "command": "compilerOptionsForInferredProjects",
      "arguments": {
        "options": {
          "module": "ESNext",
          "moduleResolution": "Bundler",
          "target": "ES2022",
          "jsx": "react",
          "allowImportingTsExtensions": true,
          "strictNullChecks": true,
          "strictFunctionTypes": true,
          "sourceMap": true,
          "allowJs": true,
          "allowSyntheticDefaultImports": true,
          "allowNonTsExtensions": true,
          "resolveJsonModule": true
        }
      }
    }
Perf 12   [22:17:14.111] 1::compilerOptionsForInferredProjects: elapsed time (in milliseconds) 0.5956
Info 13   [22:17:14.111] response:
    {"seq":0,"type":"response","command":"compilerOptionsForInferredProjects","request_seq":1,"success":true,"body":true}