-
Notifications
You must be signed in to change notification settings - Fork 55
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
Race condition in LanguageServerWrapper on exception in StreamConnectionProvider.start() #804
Comments
Thanks for the PR. Feel free to submit a PR and we'll review it. |
ChristophKaser
added a commit
to ChristophKaser/lsp4e
that referenced
this issue
Sep 14, 2023
I created a PR with a unit test that reproduces the problem reliably for me and a fix. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi everyone,
I have observed the following behavior when I use a custom StreamConnectionProvider that tries to contact a remote language server using websockets: When the server is down, eventually lsp4e stops trying to recreate the language server connection. This is caused by an exception thrown in StreamConnectionProvider.start() that causes the following race condition:
inititalizeFuture = null
CompletableFuture.supplyAsync
, which might happen before or after the start()-Exception has been handled.Sometimes, the initializeFuture gets assigned the failed future from line 259 after the stop-Method has been called in line 326. When this happens, LanguageServerWrapper.start() does not start a new language server any more, because it only checks for initializeFuture == null in https://github.com/eclipse/lsp4e/blob/9cdd9be00121f8c7fc386763e886d4e6a5f98787/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java#L256.
One possible solution might be to amend line 256 with something like
&& !this.initializeFuture.isCompletedExceptionally()
.The text was updated successfully, but these errors were encountered: