The csharp extension is leaking processes.
501 2957 1 0 8:22AM ?? 0:01.65 /Users/nils/.vscode/extensions/ms-vscode.csharp-1.17.1/.razor/rzls -lsp --logLevel None
Note: VS code is not running
dotnet --info output: Version: 2.2.103
VS Code version: 1.31.1
C# Extension version: 1.17.1
Mac OS Mojave
Proper cleanup of internal processes
@dbaeumer Razor uses the LanguageClient to turn on/off its LanguageServer. What's the best usage of LanguageClient to ensure that we dispose of the process when VSCode exits?
@NTaylorMullen the LanguageClient offers a stop method. When called it send the shutdown request to the server to tell the server process to shutdown. After receiving the shutdown response the clients sends the exit notification to ask the server process to exit.
Hmm, interesting. The server should definitely be handling that exit notification successfully then. @koliyo does it leak every time?
FYI @david-driscoll
I don't think it happens every time.
A general suggestion would be not to rely completely on shutdown callbacks/notifications. You should also look at the POSIX setpgid functionality, and how this can be used to bind child processes to the parent
See this snippet I am using in another project
https://github.com/Microsoft/vscode-python/issues/3331#issuecomment-459278663
And from setpgid man page
http://man7.org/linux/man-pages/man2/setpgid.2.html
If the termination of a process causes a process group to become
orphaned, and if any member of the newly orphaned process group is
stopped, then a SIGHUP signal followed by a SIGCONT signal will be
sent to each process in the newly orphaned process group. An
orphaned process group is one in which the parent of every member of
process group is either itself also a member of the process group or
is a member of a process group in a different session (see also
credentials(7)).
Not sure about similar functionality in Windows.
This is not isolated to any extension, such as omnisharp and python, but should be addressed systematically in VS Code. Which it does to some extent I guess.
For server's written in node this is addressed by passing the process id of the extension host to the server. Here we do this generically since we know how to start node. The Razor server uses a command to start the server. You could do the same and simply add an argument to the command that passes the process id. Our servers then check from time to time of that process still exists and if not exit themselves. This works under Linux, Mac and Windows.
@rchande / @akshita31 how do you guys ensure OmniSharp exits?
@NTaylorMullen We include it in our list of things to dispose when the extension is deactivated: https://github.com/OmniSharp/omnisharp-vscode/blob/master/src/omnisharp/extension.ts#L171
Also faced this today randomly. I'm not even trying to use Razor or C#!
Same here! Will try to provide more info if this becomes a regular issue.