Bug 442491 - Tree item expanding/collapsing is run in the UI thread
Summary: Tree item expanding/collapsing is run in the UI thread
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Tree (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0.0M6   Edit
Assignee: Belqassim Djafer CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance, triaged
Depends on:
Blocks:
 
Reported: 2014-08-25 09:45 EDT by Cedric Brun CLA
Modified: 2015-06-24 11:15 EDT (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 Cedric Brun CLA 2014-08-25 09:45:30 EDT
A tree expand/collabse in the Sirius editor might be an expensive operation as it can lead to an arbitrary computation browsing the model.

Launching those in the UI thread is not suitable as the Eclipse UI get stuck for seconds and the user have no way to cancel the operation.
Comment 1 Cedric Brun CLA 2014-08-25 09:49:10 EDT
A draft patchset is available here :
https://git.eclipse.org/r/#/c/32235/

It should not be submitted as is as it triggers reentrant calls errors when
- user create a tree
- user click on expand

Here is the stacktrace :

!MESSAGE Ignored reentrant call while viewer is busy. This is only logged once per viewer instance, but similar calls will still be ignored.
!STACK 0
java.lang.RuntimeException
	at org.eclipse.jface.viewers.ColumnViewer.checkBusy(ColumnViewer.java:781)
	at org.eclipse.jface.viewers.AbstractTreeViewer.setExpandedState(AbstractTreeViewer.java:2495)
	at org.eclipse.sirius.tree.ui.tools.internal.editor.provider.TreeUIUpdater$1.run(TreeUIUpdater.java:291)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3717)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3366)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:173)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:388)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
	at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275)
	at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:960)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:995)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:970)
	at org.eclipse.sirius.tree.ui.tools.internal.editor.listeners.DTreeViewerListener.treeExpanded(DTreeViewerListener.java:75)
	at org.eclipse.jface.viewers.AbstractTreeViewer$3.run(AbstractTreeViewer.java:1122)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.AbstractTreeViewer.fireTreeExpanded(AbstractTreeViewer.java:1120)
	at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(AbstractTreeViewer.java:1502)
	at org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeViewer.java:952)
	at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(AbstractTreeViewer.java:1511)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:132)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
	at org.eclipse.swt.widgets.Tree.gtk_test_expand_row(Tree.java:2090)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2128)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4575)
	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:8756)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1243)
	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:2302)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3361)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Comment 2 Maxime Porhel CLA 2014-08-29 05:29:15 EDT
Steps to reproduce.

Import a modeling project with a fairly big model (500K model elements for instance) with a fairly big tree. (projects attached in this bugzilla are suitable : https://bugs.eclipse.org/bugs/show_bug.cgi?id=438603)

Open a Tree  representation and play with expand/collapse.
Comment 3 Maxime Porhel CLA 2014-08-29 05:31:16 EDT
See also bug: 438603
Comment 4 Eclipse Genie CLA 2015-02-26 10:12:50 EST
New Gerrit change created: https://git.eclipse.org/r/42797
Comment 6 Eclipse Genie CLA 2015-03-02 09:04:46 EST
New Gerrit change created: https://git.eclipse.org/r/43009
Comment 8 Esteban DUGUEPEROUX CLA 2015-03-04 04:03:32 EST
Merged.
Comment 9 Eclipse Genie CLA 2015-03-04 09:30:56 EST
New Gerrit change created: https://git.eclipse.org/r/43160
Comment 11 Belqassim Djafer CLA 2015-04-10 10:20:45 EDT
Verified on Sirius 3.0.0M6
Comment 12 Pierre-Charles David CLA 2015-06-24 11:15:17 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.