dom96 / choosenim

Tool for easily installing and managing multiple versions of the Nim programming language.
BSD 3-Clause "New" or "Revised" License
679 stars 67 forks source link

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

Open nickysn opened 4 months ago

nickysn commented 4 months ago

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.

dunric commented 2 months ago

*bump*

Same issue here. Anyone already addressing the solution?

I now have to work around this problem with expose real nim executables from choosenim toolchains path in PATH environment variable.