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

helpServer never exits on reload window #911

Closed
renkun-ken opened this issue Dec 13, 2021 · 13 comments · Fixed by #912 or #918
Closed

helpServer never exits on reload window #911

renkun-ken opened this issue Dec 13, 2021 · 13 comments · Fixed by #912 or #918
Labels

Comments

@renkun-ken
Copy link
Member

renkun-ken commented Dec 13, 2021

Like #902, the help server process never exits when I reload vscode window. More specifically, whenever the extension is activated, a new help server process is started. But when the extension is deactivated or even when vscode exits, the help server processes never exit. As a result, the server will have more and more help server processes.

I have to manually kill all help server processes via

ps aux | grep helpServer.R | awk '{ print $2 }' | xargs kill -9
@ManuelHentschel
Copy link
Member

On my machine (windows 10) this bug is actually caused by #912, which is why I used tree-kill in the first place.

@renkun-ken
Copy link
Member Author

Looks like tree-kill might not work properly on Linux and macOS? What about we use both?

@renkun-ken
Copy link
Member Author

Does cp.kill() returns false in your case when it does not work as expected?

@renkun-ken
Copy link
Member Author

@renkun-ken
Copy link
Member Author

I tried using tree-kill with kill(this.cp.pid, 'SIGKILL') and it seems to work as expected.

@renkun-ken
Copy link
Member Author

renkun-ken commented Dec 13, 2021

Would you like to confirm if cp.kill('SIGKILL') or kill(pid, 'SIGKILL') work?

@renkun-ken
Copy link
Member Author

@ManuelHentschel @ElianHugh Do you have access to Windows and check whether it works as expected? Maybe we'll need another quick release, as the leaking help server processes are more and more on Linux and macOS machines on each extension activation.

@ElianHugh
Copy link
Collaborator

@ManuelHentschel @ElianHugh Do you have access to Windows and check whether it works as expected? Maybe we'll need another quick release, as the leaking help server processes are more and more on Linux and macOS machines on each extension activation.

I won't have access until the weekend unfortunately.

@renkun-ken
Copy link
Member Author

I tried the build from #912 where SIGKILL is used on a Windows 10 virtual machine, and it works as expected. Now #912 should work on Windows, Linux and macOS.

@renkun-ken
Copy link
Member Author

On Linux and macOS, the help server could be properly killed in debug mode, but not in normal use. Still looking into this.

@renkun-ken
Copy link
Member Author

renkun-ken commented Dec 15, 2021

The help server processes are following:

renkun   1189508  0.0  0.0   2872   980 ?        S    14:16   0:00 /bin/sh -c /usr/bin/R --silent --slave --no-save --no-restore -f /home/renkun/.vscode/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
renkun   1189509  0.8  0.2 611352 93372 ?        Sl   14:16   0:02 /usr/lib/R/bin/exec/R --silent --slave --no-save --no-restore -f /home/renkun/.vscode/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R

The process we keep track is the shell process where this.cp.pid = 1189508. In helpProvider.dispose(), the kill call is actually executed, but the process is not killed at all.

kill works in refresh() in both debug mode and normal use, but it only works in dispose() in debug mode, but not in normal use.

@ElianHugh
Copy link
Collaborator

ElianHugh commented Dec 15, 2021

I wonder if the pid or cp object is somehow lost during the reload process?

@renkun-ken
Copy link
Member Author

renkun-ken commented Dec 15, 2021

Looks like it has something to do with cp.exec vs cp.spawn and whether to use shell: true.

cp.exec by default uses a shell to run the command and the process is not killed in dispose().

I tried switching to cp.spawn and not using shell, just like how we start languageserver process, and cp.kill works properly while tree-kill does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants