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

Suspected Memory Leak in Language Client #1037

Open
antpensi opened this issue Sep 26, 2023 · 1 comment
Open

Suspected Memory Leak in Language Client #1037

antpensi opened this issue Sep 26, 2023 · 1 comment

Comments

@antpensi
Copy link

Hello

I am investigating a suspected memory leak in the Omnisharp Language Client. When configuring the client to handle a periodic notification from an external Language Server, I consistently observe memory usage growing unbounded.

The memory profiler within VS indicates this is coming from many Newtonsoft.Json.Linq.* objects related to the OmniSharp.Extensions.JsonRpc.Server.Notification class.

These objects appear to grow even when constructing a "no-op" notification handler, which leads me to believe it may be internal to this library.

Here is how I am constructing my Language Client -

Process process = new Process(...configured for myLangServer.exe...);

LanguageClientOptions options = new LanguageClientOptions();
options.WithInput(process.StandardOutput.BaseStream)
       .WithOutput(process.StandardInput.BaseStream)
       .OnNotification("foo/bar", (MyNotification notification) =>
       {
	    Debug.Print($"Notification received.");
       });

var languageClient = OmniSharp.Extensions.LanguageServer.Client.LanguageClient.Create(options);
await languageClient.Initialize(CancellationToken.None);

I am using version 0.19.7 of the Omnisharp.Extensions.LanguageClient NuGet package. Attaching an image detailing an example of one of these Newtonsoft objects.

devenv_PaNuYVndH7

@antpensi
Copy link
Author

image

chrissimon-au added a commit to dev-cycles/contextive that referenced this issue Nov 26, 2023
primarily by increasing timeouts, ensuring testclient and testlanguageserver is disposed properly, and adding missing conditionawaiters.

Likely still a testclient memory leak - see OmniSharp/csharp-language-server-protocol#1037
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant