-
Notifications
You must be signed in to change notification settings - Fork 145
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
Server side LSP request hangs if executed from a notification handler #775
Comments
@MiklosMagyari Thank you for the detailed report. Basically, LSP4J runs a loop in a dedicated thread that reads messages from an input stream and dispatches them to the corresponding handlers (for details, see In your specific case, the deadlock occurred because the thread that reads and dispatches incoming messages was blocked by synchronously waiting for the response to the HTH |
Thanks a lot for the clarification, that explains why this lockup happened. Btw, is this documented somewhere? Maybe I have missed it? |
@MiklosMagyari I have opened PR #777 to update the documentation. Any comments are welcome! |
Great! Short and concise, can spare hours of debugging. Thanks once again. |
@MiklosMagyari Thanks a lot for your feedback! I have merged the PR. |
I don't know if it is by design, but at least it was not trivial for me and took several hours to track down.
We have a language server built on lsp4j. Among many others, we implemented the handler for
didChangeWorkspaceFolders
. After handling the folder changes, we call the function performing a project build that creates a work progress:It turned out that calling the build like this causes sending
window/workDoneProgress/create
request to hang. Checking the trace in vscode showed that the request has been sent out and vscode responded almost immediatelly, but the CompletableFuture returned bycreateProgress()
did not complete.Finally, I have changed the code to:
This way I have no lockup.
Is it intentional that I practically need to exit notification handlers before sending out an LSP request?
The text was updated successfully, but these errors were encountered: