-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
vim.system zombie process #29475
Comments
I'm not sure
Even with the correct behaviour of detach, there's little we can do to ensure all processes are killed in the event of a crash. |
Yeah, just verified in OSX and it also leaves the process alive after neovim shutsdown.
I understand, would be nice to handle it in the normal shutdown though. |
That's surprising. My understanding was the Can you test with a simpler process? |
The OS will not automatically kill an orphaned process. It is reparented to the init process which waits for the orphaned process to exit. If a child process is connected to a pipe from the parent process (as is usually the case for an LSP server), then the child process will exit when its parent dies because the pipe is closed. But if this isn’t the case then the child will happily run forever until it’s told to stop. This is the case for regular processes anyway, I am not sure what magic libuv does behind the curtain though. |
Problem
I'm experiencing zombie process when exiting neovim even though detach is set to false.
pstree -p
when neovim is still open:pstree -p
when neovim is closed:Steps to reproduce
nvim --clean
:lua vim.system({ "kubectl", "proxy", "--port=0" }, {detach = false})
:q!
Expected behavior
I'm expecting the child process to be terminated when the parent is terminated if detached is set to false.
If I'm understanding the docs about detached correctly, I need to set it to true to make it live beyond the parents lifetime:
I have a workaround to manually kill it on VimLeavePre but I doubt that will run if neovim crashes:
Neovim version (nvim -v)
v0.11.0-dev
Vim (not Nvim) behaves the same?
I don't know
Operating system/version
Windows 11 (WSL)
Terminal name/version
Wezterm/20240203-110809-5046fc22
$TERM environment variable
xterm-256color
Installation
sudo apt-get install neovim
The text was updated successfully, but these errors were encountered: