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

Syntax server no longer exits once JDT server is initialized #1928

Closed
rgrunber opened this issue May 4, 2021 · 2 comments · Fixed by #1968
Closed

Syntax server no longer exits once JDT server is initialized #1928

rgrunber opened this issue May 4, 2021 · 2 comments · Fixed by #1968

Comments

@rgrunber
Copy link
Member

rgrunber commented May 4, 2021

Using vscode-java 0.79.0 or newer, and running watch -n1 -d 'jps -l | grep -v jps' in some terminal, I noticed that the syntax server no longer exits once the language server has completed its startup.

Environment

Linux (Fedora 33)
VS Code 1.55.2

This seems to have started happening with #1894 ( 9f32875 ) , but I don't think we do anything with the exit logic. Is there a chance this is a bug in that library ?

  • shutdown() is sent by client, and syntax server responds by saving the workspace
  • client confirms it received a response from shutdown
  • client then sends an exit() request to server
  • the SyntaxLanguageServer.exit() on the server side never gets called by the client

Instead, all I see is the following show up in the errors :

rejected promise not handled within 1 second: Error [ERR_STREAM_WRITE_AFTER_END]: write after end
stack trace: Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at writeAfterEnd (_stream_writable.js:266:14)
    at Socket.write (_stream_writable.js:315:5)
    at /home/rgrunber/git/vscode-java/dist/extension.js:2:882887
    at new Promise (<anonymous>)
    at c.write (/home/rgrunber/git/vscode-java/dist/extension.js:2:882805)
    at _.doWrite (/home/rgrunber/git/vscode-java/dist/extension.js:2:872391)
    at /home/rgrunber/git/vscode-java/dist/extension.js:2:872286

Debugging this I see it happens for the following data :
'Content-Length: 33\r\n\r\n'
{"jsonrpc":"2.0","method":"exit"}

@rgrunber
Copy link
Member Author

rgrunber commented May 5, 2021

Looks to be an upstream issue microsoft/vscode-languageserver-node#723 .

@rgrunber rgrunber self-assigned this Jun 2, 2021
rgrunber added a commit to rgrunber/vscode-java that referenced this issue Jun 2, 2021
- Fixes redhat-developer#1928
- In languageclient 7.x, the client fails to send the necessary exit()
  once a shutdown() response is received from the language server
- When client defines syntaxServerExitsOnShutdown as true, the language
  server will exit immediately after the shutdown request

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
rgrunber added a commit that referenced this issue Jun 3, 2021
- Fixes #1928
- In languageclient 7.x, the client fails to send the necessary exit()
  once a shutdown() response is received from the language server
- When client defines syntaxServerExitsOnShutdown as true, the language
  server will exit immediately after the shutdown request

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
@rgrunber
Copy link
Member Author

rgrunber commented Jun 3, 2021

As soon as the upstream issue is resolved (scheduled for 3.16.1?) we can remove this option. This should work around the issue until then.

We're basically calling exit() as part of shutdown() if the client sets this property. I've tested this in lightweight and hybrid modes, and it seems to behave correctly.

@rgrunber rgrunber added this to the Early June 2021 milestone Jun 3, 2021
rgrunber added a commit to rgrunber/vscode-java that referenced this issue Jun 28, 2021
- syntaxServerExitsOnShutdown -> shouldLanguageServerExitOnShutdown
- Standard language server should also exit on shutdown
- Related redhat-developer#1928

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
rgrunber added a commit that referenced this issue Jun 28, 2021
- syntaxServerExitsOnShutdown -> shouldLanguageServerExitOnShutdown
- Standard language server should also exit on shutdown
- Related #1928

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant