eclipse-lsp4e / eclipse-lsp4e/lsp4e
Multiple server instances where started for a document when singleton=false
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 69
- Avg merge
- 8h 33m
- Merged PRs (30d)
- 6
Description
Description:
Several language server instances gets started for a file occasionally.
Steps to reproduce:
- Setting the
singletonflag in the server definition of theorg.eclipse.lsp4e.languageServerextension point tofalse - Open a project file which triggers a LS instance to gets started, then several LS instances gets started for this file.
It looks like a race condition to me, because the (deprecated) org.eclipse.lsp4e.LanguageServerWrapper.getInitializedServer() method gets called from several threads an is not thread safe.
This could be fixed by adding synchronized to the getInitializedServer()method.
All other methods calling org.eclipse.lsp4e.LanguageServerWrapper.start() are tagged synchronized. The start() method itself is synchronized as well, but in this case this seems to be not enough.
This screenshot illustrates the problem (start() has been called twice, added a hit count = 2 to breakpoint in line 251):

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
Start with org.eclipse.lsp4e.LanguageServerWrapper.getInitializedServer() and its callers, then inspect the synchronized start() method. Reproduce with singleton=false and a project file that triggers the language server, checking whether concurrent calls create multiple instances. Done means one server instance is started for the file in the reported race scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100