You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Language client does not get a chance to send shutdown message #905
Try RedHat Java extension and/or Spring Boot Tools extension
Install both or just the Java extension.
Start VSCode open java file. Note Java extension and its LS have started. Spring Boot LS would start if it a Spring Boot project
Quit VSCode
Run jps in the terminal right away after shutting down VSCode.
You'd see:
98408 org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar <-- Java LS
2277 BootLanguageServerBootApp <-- Spring Boot LS
After 30 sec of being idle Java LS would shut itself down while Boot LS stays up as it only relies on shutdown request from the client.
Anyway, the issue is that shutting LS down is being done via LanguageClient#stop() which returns a Promise and called from extension deactivate function. It appears that shutting VSCode down is not waiting for async functions to finish in the deactivate function and therefore LS shutdown request sequence never has a chance to be executed. Therefore, rogue LS processes appear...
Alex Boyko (@BoykoAlex) this is the design of the VS Code extension host. It waits n seconds for the promise to finish. If the promise doesn't finish the extension host shuts down. Otherwise a bad extension would result in stale extension host processes. You have two possibilities to work around this:
make the server check for the process id of the extension host and exit itself if that process goes away (the process id comes on the command line as an argument and in the initialize request). This is what we do in all our servers since the extension host could die unexpected as well.
I am closing the issue since IMO there is nothing that can be done in the library itself. Please ping if you think otherwise.
Dirk Bäumer (@dbaeumer) yes, I've read later that extension has 5 sec to shutdown... I will do the same as Java LS and XML LS which is check for the parent process being around.
I'm concerned a bit by the fact that extension deactivation procedure doesn't even get to sending the shutdown message to the LS...
Activity
dbaeumer commentedon Mar 9, 2022
Alex Boyko (@BoykoAlex) this is the design of the VS Code extension host. It waits n seconds for the promise to finish. If the promise doesn't finish the extension host shuts down. Otherwise a bad extension would result in stale extension host processes. You have two possibilities to work around this:
vscode-languageserver-node/client/src/node/main.ts
Line 62 in e3fa8c7
I am closing the issue since IMO there is nothing that can be done in the library itself. Please ping if you think otherwise.
BoykoAlex commentedon Mar 9, 2022
Dirk Bäumer (@dbaeumer) yes, I've read later that extension has 5 sec to shutdown... I will do the same as Java LS and XML LS which is check for the parent process being around.
I'm concerned a bit by the fact that extension deactivation procedure doesn't even get to sending the shutdown message to the LS...