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

Leaking razor process #2851

Closed
koliyo opened this issue Feb 13, 2019 · 23 comments
Closed

Leaking razor process #2851

koliyo opened this issue Feb 13, 2019 · 23 comments
Labels

Comments

@koliyo
Copy link

koliyo commented Feb 13, 2019

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

Environment data

dotnet --info output: Version: 2.2.103
VS Code version: 1.31.1
C# Extension version: 1.17.1

Mac OS Mojave

Steps to reproduce

Expected behavior

Proper cleanup of internal processes

Actual behavior

@NTaylorMullen
Copy link
Contributor

@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?

@dbaeumer
Copy link

dbaeumer commented Feb 18, 2019

@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.

@NTaylorMullen
Copy link
Contributor

Hmm, interesting. The server should definitely be handling that exit notification successfully then. @koliyo does it leak every time?

FYI @david-driscoll

@koliyo
Copy link
Author

koliyo commented Feb 20, 2019

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
microsoft/vscode-python#3331 (comment)

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.

@koliyo
Copy link
Author

koliyo commented Feb 20, 2019

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.

@dbaeumer
Copy link

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.

@NTaylorMullen
Copy link
Contributor

@rchande / @akshita31 how do you guys ensure OmniSharp exits?

@rchande
Copy link

rchande commented Feb 20, 2019

@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

@jonathan-contracts
Copy link

Also faced this today randomly. I'm not even trying to use Razor or C#!

@tinanigro
Copy link

Same here! Will try to provide more info if this becomes a regular issue.

@awyl
Copy link

awyl commented May 25, 2022

On mac m1. Every time omnisharp start, it leaves behind a rzls process. So if I restart omnisharp or reload vscode window or completely closed vscode, it leaves behind one rzls each time.

This has been happening quite a while.

Currently on 1.38.3-beta.87-net6.0.

@jtsom
Copy link

jtsom commented Jun 15, 2022

This is a big issue. See the screenshot below - there are over a dozen of these abandoned rzls processes running - even for older versions of the extension. This is with the latest version of the C# extension, and latest Insider version of VS Code (as of today):

image

@jtsom
Copy link

jtsom commented Jul 1, 2022

Is this issue even being looked at? Seem like a major problem, and no status update since February.

@jtsom
Copy link

jtsom commented Aug 24, 2022

A Month and a half later and nothing.....

@akonyer
Copy link

akonyer commented Aug 25, 2022

I'm seeing this all the time. Most of the time I open and close VS Code I have rzls processes spun up and they hang out indefinitely, even after completely closing VSCode.

@jtsom
Copy link

jtsom commented Sep 8, 2022

I don't know how they can't recreate it. Just open VSCode and open any .NET project. Quit VSCode and check the process list. rzls is still there. Keep opening and quitting VSCode, and for each time another rzls will spin up. And stay there until they are killed (killall rzls on MacOS)

@amplicity
Copy link

I'm experiencing this today (mac m1 monterey 12.3.1). VS code 1.71.2

@mikes-gh
Copy link

mikes-gh commented Oct 17, 2022

My processes today (vscode is closed)
macOS 12.6
vscode 1.72.2
omnisharp 1.25.0

Screenshot 2022-10-18 at 00 36 15

Really slows down intelisense too.

@allisonchou
Copy link
Contributor

Hi all! C# extension v1.25.4 was released earlier today which should address this problem. Please let us know if you continue to run into issues. Thanks, and happy coding!

@dibarbet Could you help close out this issue? (I don't have permissions.)

@mikes-gh
Copy link

@allisonchou vscode doesn't appear to recognise this update yet. Is this a main stream release?

@dibarbet
Copy link
Member

@allisonchou vscode doesn't appear to recognise this update yet. Is this a main stream release?

@mikes-gh
Yeah v1.25.4 was uploaded as the latest release to the gallery yesterday.
If VSCode isn't automatically updating for you, you could try explicitly requesting another version here
image

@mikes-gh
Copy link

The short term report is rzls orphaned processes seems fixed on macOS.
Thank you 🙏 . Saves me having to manually kill the processes which was a real pain.

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

No branches or pull requests