Skip to content

A language server that is switched off starts again when a feature asks it for its language server #2036

Closed

Description

@lagergren

Problem

LanguageServerWrapper.start() starts a language server that is switched off: it returns early only for one that is disposed. getInitializedServer() calls start(), and a feature that still holds a language server calls getInitializedServer() after the language server is switched off, as LSPLazyCodeActions.loadCodeActionsFor does for the quick fixes of the diagnostics that the language server showed. So:

  • a language server that is switched off, by stopAndDisable(), by a stop of its definition or of its instance, or by too many failed starts, starts again as soon as such a feature asks it for its language server, and runs while switched off. Once the window of the failed starts has passed, this also starts again a language server that too many failed starts switched off;
  • when that happens while its stop runs, the stop never ends as stopped: stop() sets that status only if no start replaced its attempt meanwhile, so the language server stays stopping, and then started once the new start is done.

LanguageServerManager, restart() and Enable and Start switch a language server on before they start it, so only these starts by a feature are concerned. connect() already drops a connection whose attempt a stop replaced (#1867).

How it showed

LanguageServerManagerInstancesTest.testEnableAndStartOfAnInstanceWhichFailedStartsDisabledStartsNoOtherStoppedInstance failed once, on IntelliJ 2026.3 (the CI of #2033): after a.stopAndDisable(), the instance a wasn't stopped after a minute. The mock language server got textDocument/codeAction requests after the stop, from the quick fixes of the diagnostic that a showed.

Reproduction

a.stopAndDisable();
a.getInitializedServer();   // starts a again: a is never stopped

or, once a is stopped, a.getInitializedServer() starts it again while it is switched off.

Activity

  1. added this to the 0.30.2 milestone on Nov 20, 2026
  2. added a commit that references this issue on Nov 21, 2026
    0af1afc
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions