monaco-languageclient icon indicating copy to clipboard operation
monaco-languageclient copied to clipboard

Stopping the server timed out

Open NinjaInShade opened this issue 4 months ago • 2 comments

Hi, I am using a WebSocketUrl connection and creating a LanguageClientWrapper to achieve intellisense for my editor.

When I shut down my server, and the websocket server is disposed, the client receives an unhandledrejection: "Stopping the server timed out". This comes from this code in LanguageClientWrapper:

messageTransports.reader.onClose(async () => {
    await this.languageClient?.stop();
    ...
});

These seem to be the steps involved:

  1. server is started, client (browser) connects to the language server
  2. server is stopped, messageTransports.reader.onClose callback is fired
  3. this.langueClient.stop is called, which runs a Promise.race underneath with attempting to send a close message to the language server and a timeout
  4. since the server has been stopped by this point it just always times out and caused an unhandledrejection

NinjaInShade avatar May 29 '25 10:05 NinjaInShade