Skip to content

A language server whose start fails at once can stay "starting", with its error unreported #1825

Closed

Description

@lagergren

Problem

A language server whose start fails very early can be left in the starting status, with nothing logged, until the next start().

LanguageServerWrapper.start() submits the start task to a pooled thread first, and only then builds the future chain on that task's startFuture, including its failure handler (.exceptionally(...)), and assigns the chain to initializeFuture. When the task fails before start() gets there (creating the connection provider, the initialization options, or provider.start() throws), startFuture is already failed when the handler is attached, so the handler runs at once, inline, while initializeFuture is still null:

  1. the handler calls initializeFuture.completeExceptionally(...) and throws a NullPointerException;
  2. CompletableFuture catches it and makes it the result of the chain, so it is never logged;
  3. the rest of the handler, onError(...) and stop(context), is skipped;
  4. start() then assigns the failed chain to initializeFuture.

So the status stays starting, the error isn't reported, and the caller of getInitializedServer() gets the NullPointerException. The next start() recovers, since serverError is set.

This is a narrower ordering than the race in #9.

Expected

A start which fails early is reported and stops the server, whatever the timing: its status ends as stopped with the error, and the next start works.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions