So basically today I noticed my machine tanking whilst working on a python project setup to run pylint with nvim-lint. After running ps x I noticed there were 100's of zombie pylint processes.
I debugged lua/lint.lua and found nothing wrong with the logic so I dug deeper.
kill -15 90794 (kill -9 90794 does the same thing)
ps x
still shows:
...
90795 pts/30 S+ 0:00 sleep 1000
...
So basically running sigterm on a pid of a running script doesn't kill any of its subprocesses.
And this is exactly what was happening with nvim-lint and pylint since pylint is implemented as a python script with the contents:
#!/devtools/homebrew/opt/python@3.11/bin/python3.11
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_pylint
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_pylint())
Possible solutions
Launching the process detached = true and switching sigterm to sigkill will resolve this, however sigkill is quite aggressive.
So additionally, I propose we first issue sigint and then set up a timer until the process is closed. If it isn't closed by a certain duration, then hit it with a sigkill.
Ok so this issue is a tricky one I've been debugging for a few hours and relates closely to https://github.com/neovim/neovim/issues/24567
Problem
So basically today I noticed my machine tanking whilst working on a python project setup to run
pylint
with nvim-lint. After runningps x
I noticed there were 100's of zombiepylint
processes.I debugged
lua/lint.lua
and found nothing wrong with the logic so I dug deeper.What I found can be illustrated with:
test.sh
with the contents:chmod +x test.sh
./test.sh
ps x
should show something likekill -15 90794
(kill -9 90794
does the same thing)ps x
still shows:So basically running
sigterm
on apid
of a running script doesn't kill any of its subprocesses.And this is exactly what was happening with
nvim-lint
andpylint
sincepylint
is implemented as a python script with the contents:Possible solutions
Launching the process
detached = true
and switchingsigterm
tosigkill
will resolve this, howeversigkill
is quite aggressive.So additionally, I propose we first issue
sigint
and then set up a timer until the process is closed. If it isn't closed by a certain duration, then hit it with asigkill
.