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

LSP Process can live on after quitting neovim #1599

Closed
DanielSiepmann opened this issue May 16, 2022 · 6 comments · Fixed by #1604
Closed

LSP Process can live on after quitting neovim #1599

DanielSiepmann opened this issue May 16, 2022 · 6 comments · Fixed by #1604

Comments

@DanielSiepmann
Copy link

Not sure if this is an issue of phpactor or https://github.com/neovim/nvim-lspconfig/. I'm only using phpactor as LSP right now.

When I close a neovim instance which created an LSP Process, this process will still live. This can stack up to an huge number of processes after a week of work. I tend to close neovim instances and start from new when switching a concrete task within a project.

Would be cool if the LSP process is being killed as soon as the neovim process is killed.

Let me know if you need further info. Using neovim

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3

and phpactor 45207d9 with php 7.4.29

@dantleech
Copy link
Collaborator

lsp requires that the client first send a shutdown request, and only if the server responds does it send a further exit request. nvim isn't sending the exit request for some reason. vscode on the otherhand does.

i notice that the gopls language server does exit successfully with nvim, so presumably something to do with Phpactor (wven though it does respond to the shutdown request.

in the worst case could just add an self-destruct timeout after shutdown has been recieved.

dantleech added a commit that referenced this issue May 16, 2022
@dantleech
Copy link
Collaborator

dantleech commented May 16, 2022

it seems that nvim doesn't like to wait around, this PR reduces the grace period that Phpactor gives to it's services to shutdown: #1600

this improves the situation signficantly. but still a chance that phpactor won't respond in time (or the service takes longer and causes the nvim to get killed as with the previous issue we had), so probably also want to implement a self-destruct.

@dantleech dantleech pinned this issue May 16, 2022
@dantleech dantleech changed the title LSP Process lives after ending neovim LSP Process can live on after quitting neovim May 16, 2022
@DanielSiepmann
Copy link
Author

Thank you, I try to update soon. My setup is a bit to complex right now for easy updates. Will let you know whether it solved the issue for me once I gave it a try.

@przepompownia
Copy link
Contributor

Maybe #1600 solves my similar problem for which I not found any time to describe and checking where it happens.

@dantleech
Copy link
Collaborator

Reducing the grace period causes other problems, we periodically need to check if we need to kill the inotify watcher, and if we don't kill it then nvim crashes. I've pushed the grace period up to 100ms but added a self-destruct if the exit notification wasn't sent after 2.5 seconds, that should ensure no zombie processes.

@dantleech dantleech unpinned this issue May 16, 2022
@DanielSiepmann
Copy link
Author

Looks fine now. I still had stale processes after the first changes. The update to self destruct solved it.
I no longer see processes lying around. Thanks for the fast fix.

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

Successfully merging a pull request may close this issue.

3 participants