Bug 536788 - [Rename menu] can block the UI thread waiting on a response from the server
Summary: [Rename menu] can block the UI thread waiting on a response from the server
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: LSP4E (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 536892
  Show dependency tree
 
Reported: 2018-07-07 20:50 EDT by Nathan Ridge CLA
Modified: 2022-02-04 09:12 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2018-07-07 20:50:50 EDT
It appears that in some cases, LSP4E can block the UI thread while waiting on a response from the language server. Example stack trace:

!ENTRY org.eclipse.lsp4e 4 0 2018-07-07 20:38:10.751
!MESSAGE LanguageServer not initialized after 10s
!STACK 0
java.util.concurrent.TimeoutException
	at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
	at org.eclipse.lsp4e.LanguageServerWrapper.getServerCapabilities(LanguageServerWrapper.java:558)
	at org.eclipse.lsp4e.LanguageServiceAccessor.lambda$8(LanguageServiceAccessor.java:368)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getMatchingStartedWrappers(LanguageServiceAccessor.java:370)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSWrappers(LanguageServiceAccessor.java:280)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSPDocumentInfosFor(LanguageServiceAccessor.java:433)
	at org.eclipse.lsp4e.operations.rename.LSPRenameHandler.isEnabled(LSPRenameHandler.java:73)
	at org.eclipse.ui.internal.handlers.HandlerProxy.isEnabled(HandlerProxy.java:308)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.canExecute(E4HandlerProxy.java:73)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:318)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:252)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:161)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.isEnabled(HandlerServiceHandler.java:58)
	at org.eclipse.core.commands.Command.isEnabled(Command.java:838)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.canExecute(HandlerServiceImpl.java:177)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.updateElementVisibility(MenuManagerRendererFilter.java:220)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerShowProcessor.showMenu(MenuManagerShowProcessor.java:255)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerShowProcessor.menuAboutToHide(MenuManagerShowProcessor.java:112)
	at org.eclipse.jface.internal.MenuManagerEventHelper.showEventPostHelper(MenuManagerEventHelper.java:92)
	at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:471)
	at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:465)
	at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:497)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:256)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1396)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
	at org.eclipse.swt.widgets.Menu.gtk_show(Menu.java:779)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1935)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5898)
	at org.eclipse.swt.internal.gtk.GTK._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.GTK.gtk_main_do_event(GTK.java:4084)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1383)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1626)


I haven't yet investigated why the language server is not responding in 10 seconds in this case, but I think it shouldn't matter, even if it's a server-side bug: the UI thread should never be blocked on an asynchronous operation such as communication with another process.
Comment 1 Erik Brangs CLA 2018-08-01 13:05:08 EDT
I seem to have similar problems on my Eclipse Photon installation at work. However, the stack trace is slightly different.

I get UI lockups for several seconds at a time. This is very annoying. In my case, the lockups seem to happen when opening Maven pom.xml files from multi-module projects.

I also think that these operations shouldn't block the UI thread. I tried cancelling the language server initialization manually and it didn't seem to effect the operations that I wanted to use.
Comment 2 Mickael Istria CLA 2021-11-16 15:58:14 EST
Eclipse LSP4E is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/lsp4e/issues/ instead. If this issue is relevant to you, your action is required.
0. Verify this issue is still happening with latest LSP4E snapshots (from https://download.eclipse.org/lsp4e/snapshots )
  if issue has disappeared, please change status of this issue to "CLOSED WORKFORME" with some details about your testing environment and how you did verify the issue; and you're done
  if issue is still present with snapshots:
* Create a new issue at https://github.com/eclipse/lsp4e/issues/
  ** Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience)
  ** In the GitHub description, start with a link to this bugzilla ticket
  ** Optionally add new content to the description if it can helps towards resolution
  ** Submit GitHub issue
* Update bugzilla ticket
  ** Add to "See also" property (up right column) the link to the newly created GitHub issue
  ** Add a comment "Migrated to <link-to-newly-created-GitHub-issue>"
  ** Set status as CLOSED MOVED
  ** Submit

All issues that remain open will be automatically closed soon. Then the Bugzilla component for LSP4E will be archived and made read-only.