microsoft / microsoft/vscode-cpptools

Fix multiple-initialization on crash recovery - Client creation needs refactoring

Open
#12,105 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

internal Language Service
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.