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

Completion "hangs" with no response #743

Closed
vrubezhny opened this issue Aug 5, 2023 · 1 comment
Closed

Completion "hangs" with no response #743

vrubezhny opened this issue Aug 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@vrubezhny
Copy link
Contributor

In some cases Completion hardly "hangs" without a response from server logged, like:

[2023-07-20T15:04:27.107621992+02:00] LSP4E_TO_LANGUAGE_SERVER org.eclipse.wildwebdeveloper.xml:
{"jsonrpc":"2.0","id":"31","method":"textDocument/completion","params":{"textDocument":{"uri":"file:///home/jeremy/projects/eclipse/source/tycho/demo/osgi-repository/repository/pom.xml"},"position":{"line":36,"character":5}}}

For reference issue see: eclipse/lemminx-maven#444

I believe LSP4E has problems in sending a request to the server, - a problem which I'd like to be investigated - so the response cannot be generated, but even if a LS is causing the problem, completion request is never finishes on LSP4E due to "infinite waiting on the completion future by calling .get():
https://github.com/eclipse/lsp4e/blob/55ce45f20dba1147cfa8383412f0105bfe96fc2e/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java#L114C11-L114C11

this.completionLanguageServersFuture = LanguageServers.forDocument(document)
	.withFilter(capabilities -> capabilities.getCompletionProvider() != null)
	.collectAll((w, ls) -> ls.getTextDocumentService().completion(param)
		.thenAccept(completion -> proposals.addAll(toProposals(document, offset, completion, w))));
this.completionLanguageServersFuture.get();

While it's very difficult to catch the reason of sending request/receiving response failures, the using CompletableFuture.get() is to be strongly avoided.

@vrubezhny vrubezhny added the bug Something isn't working label Aug 5, 2023
vrubezhny added a commit to vrubezhny/lsp4e that referenced this issue Aug 5, 2023
Getting rid of infinite waiting in LSContentAssistProcessor

Issue: eclipse#743
@angelozerr
Copy link
Contributor

angelozerr commented Aug 5, 2023

Using this.completionLanguageServersFuture.get(); means that you trust the language server, but if language server return a result whish never finish, the Thread this.completionLanguageServersFuture.get() is never free.

If user opens several completions, a Thread is taken again and again from the pool and after several completion, there is no Thread in the pool and language server becomes unusable not only with completion but with other features like highlighting, validation etc

I suspect that this issue with strange error comes from this problem with Thread which are not available in the pool eclipse-wildwebdeveloper/wildwebdeveloper#1251

On my side when I edit a pom.xml file after some operations like completion, validation, I loose my all LSP features and I have strange error like eclipse-wildwebdeveloper/wildwebdeveloper#1251 and when I try to higlight a tag name, it doesn't work, so I suspect that there is no Thread in the pool available to process LSP operations.

angelozerr added a commit to angelozerr/lsp4e that referenced this issue Aug 8, 2023
Fixes eclipse#743

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/lsp4e that referenced this issue Aug 8, 2023
Fixes eclipse#743

Signed-off-by: azerr <azerr@redhat.com>
mickaelistria pushed a commit that referenced this issue Aug 16, 2023
Getting rid of infinite waiting in LSContentAssistProcessor

Issue: #743
mickaelistria added a commit that referenced this issue Aug 16, 2023
mickaelistria added a commit that referenced this issue Aug 16, 2023
angelozerr added a commit to angelozerr/lsp4e that referenced this issue Aug 17, 2023
Fixes eclipse#743

Signed-off-by: azerr <azerr@redhat.com>
mickaelistria pushed a commit to mickaelistria/lsp4e that referenced this issue Aug 22, 2023
Fixes eclipse#743

Signed-off-by: azerr <azerr@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants