choosenim icon indicating copy to clipboard operation
choosenim copied to clipboard

choosenim causes child nimsuggest processes not to be killed on server shutdown, when using nimlangserver

Open nickysn opened this issue 4 months ago • 1 comments

Here's the original issue, reported in the nimlangserver:

https://github.com/nim-lang/langserver/issues/184

It turned out this issue only occurs when choosenim is used. When nimlangserver is shut down, it sends SIGTERM signals to its nimsuggest child processes. Since choosenim inserts a proxy process between the real nimsuggest and nimlangserver, when the server is shut down, only the proxy is killed, leaving the real nimsuggest processes running and consuming memory.

I think the choosenim proxy should be modified in such a way, so that it doesn't leave processes running, when it's killed. One way to do it is to handle the SIGTERM signal (and the equivalent on Windows). Another possible solution is to use the execve() family of functions to spawn the real nimsuggest process, thus replacing the proxy process with the real nimsuggest, using the same process id.

nickysn avatar Feb 29 '24 13:02 nickysn