typed-ember / glint

TypeScript powered tooling for Glimmer templates
https://typed-ember.gitbook.io/glint
MIT License
110 stars 51 forks source link

Reproducible language server crash #638

Closed ef4 closed 1 year ago

ef4 commented 1 year ago

I have a reproducible situation where the language server appears to be dying or getting stuck.

  1. Generate a new v2 addon with pnpm and typescript:
EMBER_CLI_PNPM=true ember addon bug-example -b @embroider/addon-blueprint --pnpm --typescript
  1. The output is a monorepo, and the addon itself is located at ./bug-example/bug-example. Open that directory as your workspace root in vscode.

  2. In the extension host output we see several stack traces from glint-vscode, starting with "Pending response rejected since connection got disposed". Full log:

            2023-10-20 11:09:15.090 [info] Extension host with pid 40399 started
            2023-10-20 11:09:15.090 [info] Skipping acquiring lock for /Users/edward/Library/Application Support/Code/User/workspaceStorage/57c55e46ea8c0667476a1f3db0f622c7.
            2023-10-20 11:09:15.122 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
            2023-10-20 11:09:15.125 [info] ExtensionService#_doActivateExtension lifeart.vscode-ember-unstable, startup: false, activationEvent: 'onLanguage:glimmer-ts'
            2023-10-20 11:09:15.299 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
            2023-10-20 11:09:15.300 [info] ExtensionService#_doActivateExtension stkb.rewrap, startup: true, activationEvent: '*'
            2023-10-20 11:09:15.305 [info] ExtensionService#_doActivateExtension vscode.npm, startup: true, activationEvent: 'workspaceContains:package.json'
            2023-10-20 11:09:15.316 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
            2023-10-20 11:09:15.328 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
            2023-10-20 11:09:15.350 [info] ExtensionService#_doActivateExtension typed-ember.glint-vscode, startup: true, activationEvent: 'workspaceContains:**/tsconfig.json,**/jsconfig.json'
            2023-10-20 11:09:15.395 [info] Eager extensions activated
            2023-10-20 11:09:15.397 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
            2023-10-20 11:09:15.398 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
            2023-10-20 11:09:15.401 [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: false, activationEvent: 'onStartupFinished'
            2023-10-20 11:09:15.405 [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished'
            2023-10-20 11:09:15.418 [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode, startup: false, activationEvent: 'onStartupFinished'
            2023-10-20 11:09:15.430 [info] ExtensionService#_doActivateExtension streetsidesoftware.code-spell-checker, startup: false, activationEvent: 'onStartupFinished'
            2023-10-20 11:09:15.500 [info] ExtensionService#_doActivateExtension ms-vsliveshare.vsliveshare, startup: false, activationEvent: 'api', root cause: eamodio.gitlens
            2023-10-20 11:09:15.592 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
            2023-10-20 11:09:16.552 [error] Error: Pending response rejected since connection got disposed
                at Object.dispose (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:29:4460)
                at Object.dispose (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:22317)
                at xl.handleConnectionClosed (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:12276)
                at xl.handleConnectionClosed (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:50498)
                at t (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:11957)
                at sa.invoke (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:14334)
                at Lr.fire (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:15103)
                at At (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:3:6455)
                at sa.invoke (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:14334)
                at Lr.fire (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:15103)
                at ls.fireClose (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:17358)
                at Socket. (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:18888)
                at Socket.emit (node:events:525:35)
                at Pipe. (node:net:322:12)
            2023-10-20 11:09:16.553 [error] Error: Client is not running and can't be stopped. It's current state is: starting
                at xl.shutdown (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8615)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8194)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:50108)
                at xl.doInitialize (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8019)
                at async xl.start (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:4599)
                at async Nl (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:61121)
            2023-10-20 11:09:16.716 [error] Error: Client is not running and can't be stopped. It's current state is: starting
                at xl.shutdown (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8615)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8194)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:50108)
                at xl.doInitialize (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8019)
                at async xl.start (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:4599)
            2023-10-20 11:09:16.717 [error] Error: Pending response rejected since connection got disposed
                at Object.dispose (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:29:4460)
                at Object.dispose (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:22317)
                at xl.handleConnectionClosed (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:12276)
                at xl.handleConnectionClosed (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:50498)
                at t (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:11957)
                at sa.invoke (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:14334)
                at Lr.fire (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:15103)
                at At (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:3:6455)
                at sa.invoke (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:14334)
                at Lr.fire (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:15103)
                at ls.fireClose (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:17358)
                at Socket. (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:18888)
                at Socket.emit (node:events:525:35)
                at Pipe. (node:net:322:12)
            2023-10-20 11:09:16.874 [error] Error: Client is not running and can't be stopped. It's current state is: starting
                at xl.shutdown (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8615)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8194)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:50108)
                at xl.doInitialize (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8019)
                at async xl.start (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:4599)
            2023-10-20 11:09:17.027 [error] Error: Client is not running and can't be stopped. It's current state is: starting
                at xl.shutdown (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8615)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8194)
                at xl.stop (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:50108)
                at xl.doInitialize (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8019)
                at async xl.start (/Users/edward/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:4599)
    
  3. No glint feedback is present in the editor.

dfreeman commented 1 year ago

@ef4 I'm unable to reproduce this. I ran:

env EMBER_CLI_PNPM=true ember addon bug-example -b @embroider/addon-blueprint --pnpm --typescript
code bug-example/bug-example/

Then opened src/template-registry.ts and hovered the Registry identifier, which gave the expected double hover info (one from tsserver, one from glint-language-server):

Hover information from both the built-in TS support and Glint for an identifier in a .ts file

Then created a src/test.gts file, which Glint appears to provide correct hover info from:

Hover information from Glint for an identifier in a .gts file

My global ember-cli version is 5.3.0, though a difference there doesn't seem super likely to be the culprit on this.

Do you know of others that have run into this as well? Any thoughts on what the difference might be?

adc-mhaugen commented 1 year ago

I have just started experiencing this issue as of this morning @dfreeman. What information would you need?

NullVoxPopuli commented 1 year ago

Do you know of others that have run into this as well?

it could be that this is what I was running in to, and why I can't find confidence in my poking around the repo yet :sweat_smile: probably something else tho, as this message is unfamiliar to me:

2023-10-20 11:09:16.874 [error] Error: Client is not running and can't be stopped. It's current state is: starting
ef4 commented 1 year ago

I think this may have been caused by having an unrelated deprecated extension installed.

Check your list of installed extensions in vscode, they will render with warnings next to them if they're deprecated. I had a deprecated ruby syntax highlighter.

adc-mhaugen commented 1 year ago

I don't see any deprecated extension, but I did go ahead and remove all extensions that I know I'm not using. The glint server still fails, but at least now I can see the error messages which were disappearing before. The trace is:

[Trace - 4:23:19 PM] Sending request 'initialize - (0)'.
file:///Users/mhaugen/Code/adc/adc-web-frontend/node_modules/.pnpm/@glint+core@1.2.0_typescript@4.9.5/node_modules/@glint/core/lib/language-server/util/index.js:3
import VSCodeURI from 'vscode-uri';
       ^^^^^^^^^
SyntaxError: The requested module 'vscode-uri' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Node.js v18.15.0
[Error - 4:23:19 PM] Client Glint: connection to server is erroring. Shutting down server.
[Error - 4:23:19 PM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting
    at xl.shutdown (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8615)
    at xl.stop (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:8194)
    at xl.stop (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:50108)
    at xl.handleConnectionError (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:13216)
    at e (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:11915)
    at /Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:39:21531
    at sa.invoke (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:14334)
    at Lr.fire (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:15103)
    at ar (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:3:6529)
    at sa.invoke (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:14334)
    at Lr.fire (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:2:15103)
    at ds.fireError (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:3:420)
    at Socket.<anonymous> (/Users/mhaugen/.vscode/extensions/typed-ember.glint-vscode-1.0.3/dist/extension.js:3:1204)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[Info  - 4:23:19 PM] Connection to server got closed. Server will restart.
[Error - 4:23:19 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 4:23:19 PM] Glint client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
ef4 commented 1 year ago

I think that is a different issue: https://github.com/typed-ember/glint/pull/629

NullVoxPopuli commented 1 year ago

tl;dr: your @glint/core needs to be updated, @adc-mhaugen

adc-mhaugen commented 1 year ago

Yes, that was it. Thank you @NullVoxPopuli and @ef4.