Skip to content

language server crash when starting extension #945

@WinPlay02

Description

@WinPlay02

Describe the bug

The language server sometimes crashes at startup. This causes the language-specific features to no longer work.
The wrong access seems to happen in the following file: // ../../node_modules/langium/lib/lsp/document-update-handler.js.
The stacktrace is attached below.

2024-03-07 11:57:43.889 [info] c:\-\DSL\packages\safe-ds-vscode\dist\extension\mainServer.cjs:38139
  const connection = services.lsp.Connection;
                              ^

TypeError: Cannot read properties of undefined (reading 'lsp')
    at startLanguageServer (c:\-\DSL\packages\safe-ds-vscode\dist\extension\mainServer.cjs:38139:31)
    at startLanguageServer2 (c:\-\DSL\packages\safe-ds-vscode\dist\extension\mainServer.cjs:67460:3)
    at Object.<anonymous> (c:\-\DSL\packages\safe-ds-vscode\dist\extension\mainServer.cjs:67464:1)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at Function._load (node:electron/js2c/node_init:2:13357)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:96:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.17.1

2024-03-07 11:57:43.899 [info] [LanguageClient] [Error - 11:57:43] Server process exited with code 1.
2024-03-07 11:57:43.900 [info] [LanguageClient] [Error - 11:57:43] Server initialization failed.
2024-03-07 11:57:43.900 [info] [LanguageClient]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-03-07 11:57:43.901 [info] [LanguageClient] [Info  - 11:57:43] Connection to server got closed. Server will restart.
2024-03-07 11:57:43.901 [info] [LanguageClient] true
2024-03-07 11:57:43.901 [info] [LanguageClient] [Error - 11:57:43] Safe-DS client: couldn't create connection to server.
2024-03-07 11:57:43.901 [info] [LanguageClient]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-03-07 11:57:43.902 [info] [LanguageClient] [Error - 11:57:43] Restarting server failed
2024-03-07 11:57:43.902 [info] [LanguageClient]   Message: Pending response rejected since connection got disposed

To Reproduce

  1. Start extension (in debug mode from existing visual code instance)
  2. Observe crash (including the final message)
    The Safe-DS server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Expected behavior

Language features working and language server not crashing.

Screenshots (optional)

No response

Additional Context (optional)

It may be related to the langium upgrade to version 3 / 3 rc, but the commit ranges were not bisected

Metadata

Metadata

Assignees

Labels

releasedIncluded in a release

Type

No type

Projects

Status

✔️ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions