microsoft / microsoft/vscode-languageserver-node
client.needsStop() and client.stop() disagree on whether it's valid to call stop()
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 404
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 14
Description
I'm trying to fix some issues with the LSP client showing errors when I try to dispose it. One issue is that I'm getting errors like this:
rejected promise not handled within 1 second: Error: Client is not running and can't be stopped. It's current state is: starting
extensionHostProcess.js:155
stack trace: Error: Client is not running and can't be stopped. It's current state is: starting
at LanguageClient.shutdown (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:38362:10)
at LanguageClient.stop (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:38332:15)
at LanguageClient.stop (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:47462:22)
at Object.dispose (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:4810:66)
at disposeAll (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:29122:20)
at LspAnalyzer.dispose (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:25645:32)
at d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:14511:36
at tryCleanup (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:14544:15)
The problem is that calling stop() is invalid when the state is stopping, however my code looks like this:
if (this.client.needsStop())
await this.client.stop();
The implementation of needsStop is:
So needsStop says that stop is required if the state is starting, but calling stop() throws. It's not clear to me what the correct way of shutting down the server cleanly is.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in client/src/common/client.ts at needsStop and stop, then trace the client state transitions involved when disposal occurs during starting or stopping. Reproduce the mismatch described in the issue and inspect existing client tests if present. Done means the stop decision and stop behavior agree, with coverage for the reported lifecycle state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100