Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 521484 - Async content-assist (with long completion) can freeze UI Thread
Summary: Async content-assist (with long completion) can freeze UI Thread
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.8 M3   Edit
Assignee: Lucas Bullen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-28 12:15 EDT by Mickael Istria CLA
Modified: 2018-10-15 10:44 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mickael Istria CLA 2017-08-28 12:15:25 EDT
See the following stack, which shows how (async) content-assist in Generic Editor can freeze the UI Thread

"main" #1 prio=6 os_prio=0 tid=0x00007f6cfc00a000 nid=0x9f8 waiting on condition [0x00007f6d02f38000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000000f9976248> (a java.util.concurrent.CompletableFuture$Signaller)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1693)
	at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3323)
	at java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1729)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
	at org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor.lambda$1(LSContentAssistProcessor.java:97)
	at org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor$$Lambda$428/2135593843.accept(Unknown Source)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
	at org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor.computeCompletionProposals(LSContentAssistProcessor.java:95)
	at org.eclipse.ui.internal.genericeditor.ContentAssistProcessorRegistry$ContentAssistProcessorExtension.computeCompletionProposals(ContentAssistProcessorRegistry.java:107)
	at org.eclipse.jface.text.contentassist.ContentAssistant$3.run(ContentAssistant.java:2007)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:2004)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:560)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeFilteredProposals(CompletionProposalPopup.java:1491)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$3(CompletionProposalPopup.java:1480)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run(CompletionProposalPopup.java:357)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.getSelectedProposal(CompletionProposalPopup.java:909)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1365)
	at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:807)
	at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:485)
	at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:66)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5252)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1357)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1142)
	at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:6029)
	at org.eclipse.swt.custom.StyledText.lambda$1(StyledText.java:5732)
	at org.eclipse.swt.custom.StyledText$$Lambda$276/1697593996.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5252)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1357)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1386)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:768)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3526)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:785)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1976)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:6168)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5512)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9251)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1252)
	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:2110)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4105)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.ui.internal.Workbench$$Lambda$70/1399693980.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Comment 1 Mickael Istria CLA 2017-08-28 12:15:45 EDT
Tentative to 4.8.M2
Comment 2 Mickael Istria CLA 2017-08-28 12:28:56 EDT
Bug 31427 added a solution to synchronously process filtering (which delegates to content assist processor). For the Async completion, we shouldn't have to wait here.
In general, the issue with the CompletionProposalPopup is that it keeps track of selection through indexes, whereas the content can be moving. If instead of indexes, we use typical JFace model elements, we're less likely to go out of sync.
Comment 3 Eclipse Genie CLA 2017-09-08 10:06:35 EDT
New Gerrit change created: https://git.eclipse.org/r/104759
Comment 4 Mickael Istria CLA 2017-09-11 05:36:21 EDT
I'll review the patch ASAP. However, this is not a trivial change, and this bug is not a regression, so does it qualify for a fix during stabilization week?
I keep the 4.8.M2 target at the moment, if it doesn't quality, it will be for 4.8.M3.
Comment 5 Alexander Kurtakov CLA 2017-09-12 02:55:13 EDT
Mickael, time to postpone it for M3? I don't see it as really severe bug.
Comment 6 Eclipse Genie CLA 2017-09-13 12:56:28 EDT
New Gerrit change created: https://git.eclipse.org/r/105097
Comment 8 Mickael Istria CLA 2017-09-15 08:26:37 EDT
Thanks Lucas!