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

nimlangserver and nimsuggest cleanup issues on shutdown (leaving processes still running, after exit of VS Code) #70

Closed
8 tasks done
nickysn opened this issue Dec 14, 2023 · 0 comments
Assignees

Comments

@nickysn
Copy link
Collaborator

nickysn commented Dec 14, 2023

Normally, nimlangserver keeps track of all its child nimsuggest processes. During a normal shutdown, it kills them, so they're not left running. A normal shutdown implies that the LSP client (e.g. VS Code) sends a shutdown request:

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#shutdown

followed by an exit notification:

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#exit

Unfortunately, LSP clients don't always do that due to bugs, resulting in abnormal termination and this creates leftover nimlangserver and/or nimsuggest processes. It is a good idea to make nimlangserver extra robust and shutdown all processes in case of abnormal termination, LSP client crashes, etc. Even though many of these failures are sometimes bugs in the LSP client (such as VS code), users will assume it's a bug in nimlangserver and not their IDE of choice.

  • Handle shutdown without params: 0976b96
  • Handle exit without params: ed819ca
  • Use of the nimsuggest --clientProcessId:XXX command line option (only if new nimsuggest version is detected)
  • Monitor client process ID, included in the initialize LSP request. Shutdown server if needed.
  • Kill child nimsuggest processes in the above case as well: 7b9933c
  • Add an optional --clientProcessId=XXX command line option to nimlangserver, as recommended in the LSP specification here: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#implementationConsiderations 46329ea
  • Kill child nimsuggest processes in case of abnormal server termination, due to signals, such as SIGTERM, SIGPIPE, etc: bfb8f56
  • Kill child nimsuggest processes even in case of LSP exit notification, without a preceding LSP shutdown request: c369c2b
@nickysn nickysn changed the title nimlangserver and nimsuggest cleanup issues on shutdown (leaving processes still running, after exit ot VS Code) nimlangserver and nimsuggest cleanup issues on shutdown (leaving processes still running, after exit of VS Code) Dec 14, 2023
@nickysn nickysn self-assigned this Jan 26, 2024
@nickysn nickysn closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant