Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled method stops language server #1808

Closed
arnoson opened this issue Jan 6, 2023 · 4 comments
Closed

Unhandled method stops language server #1808

arnoson opened this issue Jan 6, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@arnoson
Copy link

arnoson commented Jan 6, 2023

I'm using lua-language-server together with Monaco editor in the browser via a websocket connection. Everything was working with some older binaries. Now I'm trying to use the latest binary for linux from the current release.

Monaco sends a workspace/configuration message which isn't known to the language server.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "workspace/configuration",
  "params": {
    "items": [
      {
        "section": "Lua"
      },
      {
        "section": "files.associations"
      },
      {
        "section": "files.exclude"
      },
      {
        "section": "editor.semanticHighlighting.enabled"
      },
      {
        "section": "editor.acceptSuggestionOnEnter"
      }
    ]
  }
}

In the previous version this error was only sent as a response to the browser, but the language server kept working (therefore I didn't even notice it).

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32601,
    "message": "Unhandled method workspace/configuration"
  }
}

Now the language server crashes due to an assert in lua.

[14:28:40.953][error][#0:script/await.lua:35]: script/proto/proto.lua:56: assertion failed!
stack traceback:
	[C]: in function 'assert'
	script/proto/proto.lua:56: in function 'proto.proto.response'
	script/proto/proto.lua:179: in local 'f'
	script/utility.lua:436: in metamethod 'close'
	script/proto/proto.lua:186: in function <script/proto/proto.lua:159>
stack traceback:
	script/await.lua:35: in function 'await.checkResult'
	(...tail calls...)
	script/await.lua:213: in function 'await.step'
	script/service/service.lua:170: in local 'doSomething'
	script/service/service.lua:189: in function 'service.eventLoop'
	script/service/service.lua:274: in function 'service.start'
	...co-lua-example/server/lua-language-server/linux/main.lua:79: in main chunk
	...ua-example/server/lua-language-server/linux/bin/main.lua:85: in main chunk
	[C]: in ?

I'm not sure if I can configure monaco to not send the workspace/configuration message. Is there anyway to ignore undhandled methods without crashing the language server?

@arnoson
Copy link
Author

arnoson commented Jan 6, 2023

Ah I just realized that its the other way round, the language server is sending workspace/configuration and monaco throws the error. In the previous language server version I was using this error from monaco was ignored and now it is crashing. So I guess I have to define/mock the workspace/configuration in monaco.

@sumneko
Copy link
Collaborator

sumneko commented Jan 6, 2023

This assert is used for rpc.
It means the client responsed with wrong rpc id, maybe it reponsed multi times.

@sumneko sumneko added the question User has a question label Jan 6, 2023
@arnoson
Copy link
Author

arnoson commented Jan 6, 2023

Yes you're right, the error went away after I restarted everything.
I still can't get any completion working with the new version. The language server just responds with "result": "null" to everything.
This is the complete log:

[15:16:58.988][info] [#0:/home/arno/dev/monaco-lua-example/server/lua-language-server/linux/main.lua:66]: Lua Lsp startup, root: 	/home/arno/dev/monaco-lua-example/server/lua-language-server/linux
[15:16:58.988][info] [#0:/home/arno/dev/monaco-lua-example/server/lua-language-server/linux/main.lua:67]: ROOT:	/home/arno/dev/monaco-lua-example/server/lua-language-server/linux
[15:16:58.989][info] [#0:/home/arno/dev/monaco-lua-example/server/lua-language-server/linux/main.lua:68]: LOGPATH:	/home/arno/dev/monaco-lua-example/server/lua-language-server/linux/log
[15:16:58.989][info] [#0:/home/arno/dev/monaco-lua-example/server/lua-language-server/linux/main.lua:69]: METAPATH:	/home/arno/dev/monaco-lua-example/server/lua-language-server/linux/meta
[15:16:58.989][info] [#0:/home/arno/dev/monaco-lua-example/server/lua-language-server/linux/main.lua:70]: VERSION:	3.6.4-dev
[15:16:59.118][info] [#0:script/service/service.lua:141]: 
========= Medical Examination Report =========
    --------------- Memory ---------------
        Total: 1.562 MB
        # 00 : 1.562 MB
        # 01 : 0.000 MB
        # 02 : 0.000 MB
        # 03 : 0.000 MB
        # 04 : 0.000 MB
    --------------- Coroutine ---------------
        Total:     0
        Running:   0
        Suspended: 0
        Normal:    0
        Dead:      0
    --------------- Cache ---------------
        Total: 1
        Dead:  0
    ---------------  RPC  ---------------
        Holdon:   0
        Waiting:  0
==============================================
[15:16:59.132][info] [#0:script/language.lua:137]: VSC language: en-US
[15:16:59.132][info] [#0:script/language.lua:138]: LS  language: en-us
[15:16:59.340][warn] [#0:script/proto/proto.lua:104]: Response of [workspace/configuration] error [-32601]: Unhandled method workspace/configuration
[15:16:59.340][warn] [#0:script/config/loader.lua:116]: No config?	nil
[15:16:59.340][info] [#0:script/provider/provider.lua:56]: Load config from client	fallback
[15:16:59.340][info] [#0:script/provider/provider.lua:57]: nil
[15:16:59.340][info] [#0:script/library.lua:209]: Init builtin library at:	nil
[15:16:59.377][info] [#0:script/provider/completion.lua:43]: Enable completion.
[15:16:59.478][info] [#0:script/workspace/workspace.lua:304]: Preload start:	<fallback>
[15:16:59.480][info] [#0:script/workspace/workspace.lua:327]: Scan library at:	file:///home/arno/dev/monaco-lua-example/server/lua-language-server/linux/meta/Lua%205.4%20en-us%20utf8
[15:16:59.582][info] [#0:script/workspace/workspace.lua:347]: Found 11 files at:	<fallback>
[15:16:59.583][info] [#0:script/workspace/loading.lua:157]: Load files from disk:	<fallback>
[15:16:59.850][info] [#0:script/workspace/loading.lua:169]: Loaded files takes [0.071] sec: <fallback>
[15:16:59.851][info] [#0:script/workspace/loading.lua:178]: Compile files takes [0.001] sec: <fallback>
[15:16:59.851][info] [#0:script/workspace/loading.lua:179]: Loaded finish:	<fallback>
[15:16:59.851][info] [#0:script/workspace/workspace.lua:349]: Preload finish at:	<fallback>

This is propably not an issue with your library but with my setup, so feel free to close the issue if you don't have time to investigate this!

@sumneko sumneko added bug Something isn't working and removed question User has a question labels Jan 12, 2023
@sumneko
Copy link
Collaborator

sumneko commented Jan 12, 2023

Should not crash due to wrong but recoverable RPC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants