Skip to content

org.eclipse.lsp4e.outline.HasCNFOutlinePage.test can freeze the UI when an editor is opened #1330

@rubenporras

Description

@rubenporras

We have observed the following UI freeze caused by LSP4E:

!ENTRY org.eclipse.ui.monitoring 2 0 2025-07-21 10:02:20.925
!MESSAGE UI freeze of 0.31s at 10:02:20.596
!SUBENTRY 1 org.eclipse.ui.monitoring 1 0 2025-07-21 10:02:20.925
!MESSAGE Sample at 10:02:20.797 (+0.201s)
Thread 'main' tid=1 (TIMED_WAITING)
!STACK 0
Stack Trace
	at [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
	at [email protected]/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
	at [email protected]/java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1866)
	at [email protected]/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3463)
	at [email protected]/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3434)
	at [email protected]/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1939)
	at [email protected]/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
	at org.eclipse.lsp4e.outline.EditorToOutlineAdapterFactory.getAdapter(EditorToOutlineAdapterFactory.java:68)
	at org.eclipse.core.internal.adapter.AdapterFactoryProxy.lambda$5(AdapterFactoryProxy.java:111)
	at org.eclipse.core.internal.adapter.AdapterFactoryProxy$$Lambda$697/0x0000000800d336a0.apply(Unknown Source)
	at [email protected]/java.util.Optional.map(Optional.java:260)
	at org.eclipse.core.internal.adapter.AdapterFactoryProxy.getAdapter(AdapterFactoryProxy.java:111)
	at org.eclipse.core.internal.runtime.AdapterManager.lambda$7(AdapterManager.java:253)
	at org.eclipse.core.internal.runtime.AdapterManager$$Lambda$680/0x00000008012fced0.apply(Unknown Source)
	at [email protected]/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at [email protected]/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
	at [email protected]/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at [email protected]/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at [email protected]/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at [email protected]/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at [email protected]/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at [email protected]/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at [email protected]/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
	at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:266)
	at org.eclipse.ui.part.WorkbenchPart.getAdapter(WorkbenchPart.java:152)
	at org.eclipse.ui.texteditor.AbstractTextEditor.getAdapter(AbstractTextEditor.java:6196)
	at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.getAdapter(AbstractDecoratedTextEditor.java:1479)
	at org.eclipse.ui.editors.text.TextEditor.getAdapter(TextEditor.java:163)
	at org.eclipse.lsp4e.outline.HasCNFOutlinePage.test(HasCNFOutlinePage.java:28)
	at org.eclipse.core.internal.expressions.Property.test(Property.java:65)
	at org.eclipse.core.expressions.TestExpression.evaluate(TestExpression.java:107)
	at org.eclipse.core.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:54)
	at org.eclipse.core.expressions.WithExpression.evaluate(WithExpression.java:84)
	at org.eclipse.core.expressions.ReferenceExpression.evaluate(ReferenceExpression.java:72)
	at org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isCoreExpressionVisible(ContributionsAnalyzer.java:263)
	at org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isVisible(ContributionsAnalyzer.java:237)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributionRecord.computeVisibility(ContributionRecord.java:167)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributionRecord.updateVisibility(ContributionRecord.java:98)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer$1.changed(MenuManagerRenderer.java:539)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:105)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:358)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:374)
	at org.eclipse.ui.internal.WorkbenchPage.updateActiveEditorSources(WorkbenchPage.java:414)
	at org.eclipse.ui.internal.WorkbenchPage.updateBroughtToTop(WorkbenchPage.java:464)
	at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partBroughtToTop(WorkbenchPage.java:221)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$6.run(PartServiceImpl.java:314)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartBroughtToTop(PartServiceImpl.java:311)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.lambda$0(PartServiceImpl.java:107)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$$Lambda$490/0x00000008012cca58.handleEvent(Unknown Source)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$$Lambda$430/0x00000008011b1aa8.run(Unknown Source)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:183)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4941)
	at org.eclipse.e4.ui.workbench.swt.DisplayUISynchronize.syncExec(DisplayUISynchronize.java:34)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:206)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:201)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:131)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:73)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(ElementContainerImpl.java:168)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:187)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:654)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:618)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:796)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:401)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1271)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3228)
	at org.eclipse.ui.internal.WorkbenchPage.lambda$11(WorkbenchPage.java:3118)
	at org.eclipse.ui.internal.WorkbenchPage$$Lambda$1156/0x00000008017cab98.run(Unknown Source)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3116)
...

Most probably this can be avoided if the tester does not ask for the outline page as in

IContentOutlinePage outlinePage = editor.getAdapter(IContentOutlinePage.class);
return outlinePage instanceof CNFOutlinePage;

and instead it has checks if there is a language server with the capability ServerCapabilities::getDocumentSymbolProvider and it is active.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions