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

fix: Prevent LanguageServers.forProject().anyMatching() from blocking #1179

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

sebthom
Copy link
Member

@sebthom sebthom commented Jan 14, 2025

This PR addresses #894

LanguageServers.forProject(...).anyMatching() may unexpectedly block for up to 10 seconds per matching language server.

The issue occurs because LanguageServers.forProject(...).anyMatching() internally calls LanguageServiceAccessor.capabilitiesComply(), which in turn invokes LanguageServerWrapper.getServerCapabilities(). This method waits up to 10 seconds for the server to initialize, causing potential delays.

This fix ensures non-blocking behavior by addressing the synchronous invocation chain.


The offending call chain is:

org.eclipse.jface.text.TextViewerHoverManager.doPresentInformation() or
org.eclipse.ui.internal.views.markers.MarkersTreeViewer.doUpdateItem()
-> LSPCodeActionMarkerResolution.checkMarkerResolution()
   -> LanguageServerProjectExecutor.withCapability(ServerCapabilities::getCodeActionProvider)
        .anyMatching()
      -> LanguageServerProjectExecutor.getServers()
         -> LanguageServiceAccessor.getStartedWrappers()
            -> ...capabilitiesComply(ServerCapabilities::getCodeActionProvider)
               -> LanguageServerWrapper.getServerCapabilities()
                  -> ...getInitializedServer().get(10, TimeUnit.SECONDS);

@rubenporras
Copy link
Contributor

rubenporras commented Jan 15, 2025

@sebthom , I was planning on doing a release early next week. Since I see you are now working very actively on LSP4E, should I wait for some PR that you may have planned?

@sebthom
Copy link
Member Author

sebthom commented Jan 15, 2025

@sebthom , I was planning on doing a release early next week. Since I see you are now working very actively on LSP4E, should I wait for some PR that you may have planned?

Feel free to release as planned. Thanks for checking!

@sebthom sebthom merged commit fa4a00e into eclipse-lsp4e:main Jan 15, 2025
6 checks passed
@sebthom sebthom deleted the issue-894 branch January 15, 2025 10:55
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.

2 participants