TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

JS/TS language features keep restarting

Open chriskrycho opened this issue 2 years ago • 10 comments

Type: Bug

Unfortunately, I have no idea how to reproduce this, but am happy to demonstrate in a pairing session with someone.

Description: For the last week or so, I've seen VS Code attempting, and failing, to fully load its JS/TS language features. VS Code eventually shows a prompt, which reports that the extension has crashed and been restarted repeatedly in the last five minutes, and that it may be related to the Svelte plugin. However, I have disabled that plugin (as well as the Glint plugin we use for our Ember code) and it continues to occur, and in fact I have done the "Reload with extensions disabled" command and that has the same problem.

VS Code version: Code 1.74.3 (Universal) (97dec172d3256f8ca4bfb2143f3f76b503ca0534, 2023-01-09T17:07:18.579Z) OS version: Darwin arm64 21.6.0 Modes: Sandboxed: No

System Info
Item Value
CPUs Apple M1 Pro (10 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
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 6, 5, 5
Memory (System) 32.00GB (2.52GB free)
Process Argv voyager-web.code-workspace
Screen Reader no
VM 0%
Extensions (79)
Extension Author (truncated) Version
codesnap adp 1.3.4
vscode-css-modules and 1.2.3
github-markdown-preview bie 0.3.0
markdown-checkbox bie 0.4.0
markdown-emoji bie 0.3.0
markdown-footnotes bie 0.1.1
markdown-mermaid bie 1.17.4
markdown-preview-github-styles bie 1.0.1
markdown-yaml-preamble bie 0.1.0
better-toml bun 0.3.2
vscode-yarn-script car 0.0.1
vscode-glimmer chi 0.0.4
npm-intellisense chr 1.4.4
gitignore cod 0.9.0
vscode-github-actions csc 0.24.4
vscode-eslint dba 2.2.6
confluence-markup den 1.0.0
binary-plist dni 0.11.0
nunjucks-vscode-extensionpack dou 0.0.1
vscode-wasm dts 1.4.0
gitlens eam 13.2.0
EditorConfig Edi 0.16.4
vscode-npm-script eg2 0.3.29
prettier-vscode esb 9.10.4
open-in-marked fmo 1.0.9
auto-rename-tag for 0.1.10
remotehub Git 0.48.0
vscode-graphql Gra 0.8.5
vscode-graphql-syntax Gra 1.0.6
vscode-test-explorer hbe 2.21.1
output-colorizer IBM 0.1.2
vscode-edit-csv jan 0.7.2
language-haskell jus 3.6.0
center-editor-window kai 2.3.0
swift Kas 0.2.0
auto-comment-blocks kev 1.0.1
template-string-converter meg 0.6.0
dotenv mik 1.0.1
vscode-scss mrm 0.10.0
isort ms- 2022.8.0
python ms- 2022.20.2
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.14
remote-ssh ms- 0.94.0
remote-wsl ms- 0.72.0
vscode-remote-extensionpack ms- 0.23.0
atom-keybindings ms- 3.2.0
hexeditor ms- 1.9.10
live-server ms- 0.4.4
remote-explorer ms- 0.0.3
remote-repositories ms- 0.26.0
test-adapter-converter ms- 0.1.6
vscode-js-profile-flame ms- 1.0.5
quicktype qui 12.0.46
tsserver-live-reload rbu 1.0.1
vscode-yaml red 1.11.0
rust-analyzer rus 0.3.1377
jinjahtml sam 0.20.0
crates ser 0.5.10
vscode-table-formatter shu 1.2.1
fish-vscode sky 0.2.1
rewrap stk 1.16.3
vscode-stylelint sty 1.2.3
file-hopper suc 0.3.5
svelte-vscode sve 107.0.2
enumerator swi 0.0.6
vscode-open-in-github sys 1.17.1
shellcheck tim 0.29.3
glint-vscode typ 1.0.1
sort-lines Tyr 1.9.1
vscode-mdx uni 1.2.0
unison uni 0.0.8
vscode-lldb vad 1.8.1
gistfs vsl 0.4.1
file-icons-mac way 1.0.1
vscode-todo-highlight way 1.0.5
change-case wma 1.0.0
markdown-all-in-one yzh 3.5.0
vitest-explorer Zix 0.2.37

(14 theme extensions excluded)

chriskrycho avatar Jan 24 '23 21:01 chriskrycho

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

mjbvz avatar Jan 24 '23 21:01 mjbvz

It does indeed reproduce in that mode.

https://user-images.githubusercontent.com/2403023/214440004-58915119-8816-4e2b-a2fb-e34a38fb41ee.mp4

chriskrycho avatar Jan 24 '23 23:01 chriskrycho

My colleague @hmajoros did some further debugging and found a bit more info:

vscode attempts to create a TS project to better analyze the non-TS package you are in, and kicks off a build for every single reference ’d project we have in the top level tsconfig.json

As suggested by that, we have a “solution”-style tsconfig.json for a mixed-TS-and-JS project.

chriskrycho avatar Jan 31 '23 15:01 chriskrycho

Can you please try collecting the TS Server log from the crashed instance. To do this:

1.In your setting Set "typescript.tsserver.log": "verbose"

  1. Restart VS Code and reproduce the problem

  2. Open the TypeScript section of the output panel

  3. 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 and please share that. If you can share the log, I can 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

mjbvz avatar Jan 31 '23 16:01 mjbvz

here are the last few lines of my tsserver.log

Info 10594[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/organization-shared/addon/components/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10595[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/organization-shared/addon/components/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10596[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/organization-shared/addon/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10597[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/organization-shared/addon/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10598[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/organization-shared/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10599[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/organization-shared/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10600[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10601[12:08:05.077] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/addons/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10602[12:08:05.078] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10603[12:08:05.078] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/packages/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10604[12:08:05.078] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info 10605[12:08:05.079] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 10606[12:08:05.087] DirectoryWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations
Info 10607[12:08:05.087] Elapsed:: 0.008130013942718506ms DirectoryWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations
Info 10608[12:08:05.087] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/node_modules/@glimmer/component/package.json 2000 undefined Project: /dev/null/inferredProject1* WatchType: File location affecting resolution
Info 10609[12:08:05.089] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/node_modules/@glimmer/tracking/package.json 2000 undefined Project: /dev/null/inferredProject1* WatchType: File location affecting resolution
Info 10610[12:08:05.096] FileWatcher:: Added:: WatchInfo: /Users/hmajoros/Job/voyager-web/node_modules/@types/ember__object/package.json 2000 undefined Project: /dev/null/inferredProject1* WatchType: File location affecting resolution

once we get to this point, in the Output tab we see a new tsserver log created, and this loops on indefinitely:

[Info  - 17:07:02.51] Starting TS Server
[Info  - 17:07:02.51] Using tsserver from: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js
[Info  - 17:07:02.53] <syntax> Log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-CQctWX/tsserver.log
[Info  - 17:07:02.53] <syntax> Forking...
[Info  - 17:07:02.55] <syntax> Starting...
[Info  - 17:07:02.56] <semantic> Log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-J4pOhd/tsserver.log
[Info  - 17:07:02.56] <semantic> Forking...
[Info  - 17:07:02.57] <semantic> Starting...
[Error  - 17:08:19.15] TSServer exited. Code: null. Signal: SIGABRT
[Info  - 17:08:19.15] TSServer log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-J4pOhd/tsserver.log
[Info  - 17:08:19.16] Starting TS Server
[Info  - 17:08:19.16] Using tsserver from: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js
[Info  - 17:08:19.17] <syntax> Log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-svW805/tsserver.log
[Info  - 17:08:19.17] <syntax> Forking...
[Info  - 17:08:19.18] <syntax> Starting...
[Info  - 17:08:19.19] <semantic> Log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-55o6Vv/tsserver.log
[Info  - 17:08:19.19] <semantic> Forking...
[Info  - 17:08:19.20] <semantic> Starting...
[Error  - 17:09:29.604] TSServer exited. Code: null. Signal: SIGABRT
[Info  - 17:09:29.604] TSServer log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-55o6Vv/tsserver.log
[Info  - 17:09:29.604] Starting TS Server
[Info  - 17:09:29.604] Using tsserver from: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js
[Info  - 17:09:29.605] <syntax> Log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-Wwwoes/tsserver.log
[Info  - 17:09:29.605] <syntax> Forking...
[Info  - 17:09:29.606] <syntax> Starting...
[Info  - 17:09:29.606] <semantic> Log file: /Users/hmajoros/Library/Application Support/Code/logs/20230131T115846/window1/exthost/vscode.typescript-language-features/tsserver-log-6SWIni/tsserver.log
[Info  - 17:09:29.606] <semantic> Forking...
[Info  - 17:09:29.607] <semantic> Starting...

let me know if you need additional info. FWIW I didn't see any specific Error logs in the tsserver.log

hmajoros avatar Jan 31 '23 17:01 hmajoros

Hey @mjbvz, this issue might need further attention.

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

vscodenpa avatar Apr 22 '23 11:04 vscodenpa

This is still an issue in our large monorepo; I believe @hmajoros had made a little more progress on why but not much. Net, it seems like Code is trying to start up a new TSServer instance for every project in the monorepo—and failing. Given hundreds of packages in the monorepo, this makes for quite the noisy experience!

chriskrycho avatar Apr 22 '23 14:04 chriskrycho

Moving upstream to TS to see if they have any suggestions on what to check next

mjbvz avatar Apr 24 '23 21:04 mjbvz

it seems like Code is trying to start up a new TSServer instance for every project in the monorepo

Are you of you subrepos linked together with project references? Can you share a monorepo that demonstrates this?

mjbvz avatar Apr 24 '23 21:04 mjbvz

Looks like this is still an active issue, and my logs look pretty similar. @mjbvz I think the outlook repo is suffering from this, could chat more if you want to ping me on teams

zachbryant avatar Aug 26 '24 22:08 zachbryant