eclipse-lsp4e / eclipse-lsp4e/lsp4e

Clean up lifecycle code

Open
#415 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
85
Forks
69
Avg merge
8h 33m
Merged PRs (30d)
6

Description

This isn't a coherent proposal as such (yet!), I just wanted to note down some observations as I've spent quite a bit of time in the low-level lifecycle code one way or another recently. I think it would be good to do a bit of maintenance on this area.

  • I think there are some outstanding, subtle race conditions that can occur when .start() and .stop() overlap in LanguageServerWrapper. I'm not quite sure what they are, and making the default timeout > 0 probably makes them less likely, but I definitely saw some 'odd' errors when investigating the issues with LSPFileFormatHandler. It would be good to pick through this very carefully and check how they interact.
  • Document connection in LanguageServerWrapper looks to be missing a layer of coordination when multiple operations are trying to connect to a document at overlapping times. I think this is benign, but it does result in a lot of unnecessary tasks spawned in the fork join pool. It might be better to have a second map of 'pending connection' futures so that multiple calls to this function all return the same object.
  • The start() method is a bit scary, constructing several CompletableFuture objects chained together, with a lot of very long blocks of statements inline. It would be nice to split things such as the construction of the initialisation parameters out into separate methods, so that the overall critical flow of control (and the various possible lifecycle stages) became easier to read.

What do others think? Happy to spend a bit of time on this at some point if people agree.

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

Begin with LanguageServerWrapper and the LSPFileFormatHandler issues mentioned in the report. Trace overlapping start/stop and document-connection operations, then review the existing CompletableFuture flow. Done would require an agreed scope, verified lifecycle behavior, and evidence covering the reported races and redundant tasks.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.