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

Solve issue #1113. #1345

Merged
merged 2 commits into from
Jan 24, 2019
Merged

Solve issue #1113. #1345

merged 2 commits into from
Jan 24, 2019

Conversation

LoneBoco
Copy link
Contributor

Send cancellation token when the server shuts down so we terminate the process.

@rchande
Copy link

rchande commented Nov 27, 2018

@david-driscoll Does this look right to you?

@bjorkstromm
Copy link
Member

I’d say we should look at updating LSP libs to latest instead. @david-driscoll, this is fixed there, right?

@bjorkstromm
Copy link
Member

That said, I might have some time updating that in the end of this week.

@LoneBoco
Copy link
Contributor Author

I took a look at OmniSharp.Extensions.LanguageServer version 0.10.0. I couldn't get it to work correctly because there has been a ton of changes since the 0.8.0 version I use in my local repository, but this would still be a problem with the latest version.

The issue is here:

using (var host = new LanguageServerHost(
Console.OpenStandardInput(),
Console.OpenStandardOutput(),
application,
cancellation))
{
host.Start().Wait();
cancellation.Token.WaitHandle.WaitOne();
}

OmniSharp.exe waits on the cancellation token. The only things that trigger this cancellation token is closing the console or waiting for the host process to terminate. If the host process sends an Exit request, the server will shut down, but the cancellation token for OmniSharp.exe will never get triggered, so the .exe keeps running.

If you want to use version 0.10.0, you have to do something like:

_server.Exit.Subscribe(_cancellationTokenSource.Token);

I think that would work. I never tested it though as I couldn't get 0.10.0 to work.

@rchande
Copy link

rchande commented Jan 22, 2019

@mholo65 @david-driscoll I haven't been following along with LSP very much so I'm going to leave it to you to handle this PR.

@bjorkstromm
Copy link
Member

Yes, I think we should add this to PR #1387. @LoneBoco, would you mind targeting that branch instead (feature/update-lsp) Otherwise, I can look in to it and add it.

LoneBoco and others added 2 commits January 24, 2019 23:11
Send cancellation token when the server shuts down so we terminate the process.
Copy link
Member

@bjorkstromm bjorkstromm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
Tried it out locally, and /shutdown works now. It didn't work with v1.32.9 release.

@LoneBoco I rebased this and also added a note to changelog. Thank you for your contribution!

@rchande would you mind approving the changelog?

@filipw
Copy link
Member

filipw commented Jan 24, 2019

👍

@bjorkstromm bjorkstromm merged commit 06e3f45 into OmniSharp:master Jan 24, 2019
@LoneBoco LoneBoco deleted the fix-server-exit branch January 25, 2019 02:38
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

Successfully merging this pull request may close these issues.

4 participants