Skip to content

Language client does not get a chance to send shutdown message  #905

Closed

Description

@BoykoAlex

Try RedHat Java extension and/or Spring Boot Tools extension

  1. Install both or just the Java extension.
  2. Start VSCode open java file. Note Java extension and its LS have started. Spring Boot LS would start if it a Spring Boot project
  3. Quit VSCode
  4. Run jps in the terminal right away after shutting down VSCode.
    You'd see:
98408 org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar <-- Java LS
2277 BootLanguageServerBootApp <-- Spring Boot LS

After 30 sec of being idle Java LS would shut itself down while Boot LS stays up as it only relies on shutdown request from the client.

Anyway, the issue is that shutting LS down is being done via LanguageClient#stop() which returns a Promise and called from extension deactivate function. It appears that shutting VSCode down is not waiting for async functions to finish in the deactivate function and therefore LS shutdown request sequence never has a chance to be executed. Therefore, rogue LS processes appear...

Activity

  1. dbaeumer commented on Mar 9, 2022

    @dbaeumer
    Member

    Alex Boyko (@BoykoAlex) this is the design of the VS Code extension host. It waits n seconds for the promise to finish. If the promise doesn't finish the extension host shuts down. Otherwise a bad extension would result in stale extension host processes. You have two possibilities to work around this:

    • start your server in detached mode ( ) and manage everything yourself.
    • make the server check for the process id of the extension host and exit itself if that process goes away (the process id comes on the command line as an argument and in the initialize request). This is what we do in all our servers since the extension host could die unexpected as well.

    I am closing the issue since IMO there is nothing that can be done in the library itself. Please ping if you think otherwise.

  2. BoykoAlex commented on Mar 9, 2022

    @BoykoAlex
    Author

    Dirk Bäumer (@dbaeumer) yes, I've read later that extension has 5 sec to shutdown... I will do the same as Java LS and XML LS which is check for the parent process being around.
    I'm concerned a bit by the fact that extension deactivation procedure doesn't even get to sending the shutdown message to the LS...

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