microsoft / microsoft/vscode-cpptools
Fix multiple-initialization on crash recovery - Client creation needs refactoring
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
The process of creating client/languageClient objects when the extension initializes, or recovers from a crash, is not well managed/synchronized. There is a mixture of async code and sync code (that kicks off async code without waiting for it).
Currently, there is a bug where, if the process of recovering from a crash is interrupted with another crash (in the LSP initialization message) or a transient failure to execute the process, two crash recoveries will run simultaneously, resulting in multiple initializations of the same cpptools process.
Although we can move sync code out of constructors (for DefaultClient, etc.) and into async init functions fairly simply, so we can await stuff, that incurs possible deadlocks (perhaps in combination with the enqueue chain, which is client-specific), making this not a trivial fix.
Contributor guide
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
Trace extension initialization and crash recovery through the constructors for DefaultClient and related client/languageClient creation, then examine the client-specific enqueue chain and LSP initialization message. Identify where concurrent recovery can overlap and where synchronous code starts asynchronous work. Done means interrupted recovery cannot trigger multiple initializations of the same cpptools process without introducing deadlocks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100