xzer / run-jetty-run

Official successor of https://code.google.com/p/run-jetty-run/
86 stars 26 forks source link

The jetty plugin makes opening "run configurations" very slow #195

Open aaime opened 8 years ago

aaime commented 8 years ago

I'm checking out the plugin, nicely done. However I noticed that since installing and using it, opening the "run configuration" dialog to edit params takes a long time (10+ seconds on a recent laptop with a core i7). This happens only if the last run was done via the jetty runner, and also happens switching to another jetty run configuration once the dialog has been opened. The CPU is 100% used during that time.

aaime commented 8 years ago

I captured the following from jstack while switching to a jetty run config:

"main" #1 prio=6 os_prio=0 tid=0x00007f850000b000 nid=0x7d12 runnable [0x00007f850a12d000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.core.internal.dtree.AbstractDataTreeNode.indexOfChild(AbstractDataTreeNode.java:463)
        at org.eclipse.core.internal.dtree.AbstractDataTreeNode.childAtOrNull(AbstractDataTreeNode.java:251)
        at org.eclipse.core.internal.dtree.DeltaDataTree.lookup(DeltaDataTree.java:682)
        at org.eclipse.core.internal.watson.ElementTree.includes(ElementTree.java:530)
        - locked <0x00000000d909b698> (a org.eclipse.core.internal.watson.ElementTree)
        at org.eclipse.core.internal.resources.Workspace.getResourceInfo(Workspace.java:1697)
        at org.eclipse.core.internal.resources.Resource.getResourceInfo(Resource.java:1202)
        at org.eclipse.core.internal.resources.Resource.exists(Resource.java:967)
        at org.eclipse.core.internal.localstore.FileSystemResourceManager.allPathsForLocationNonCanonical(FileSystemResourceManager.java:85)
        at org.eclipse.core.internal.localstore.FileSystemResourceManager.allPathsForLocation(FileSystemResourceManager.java:65)
        at org.eclipse.core.internal.localstore.FileSystemResourceManager.allResourcesFor(FileSystemResourceManager.java:221)
        at org.eclipse.core.internal.resources.WorkspaceRoot.findFilesForLocationURI(WorkspaceRoot.java:94)
        at org.eclipse.core.internal.resources.WorkspaceRoot.findFilesForLocationURI(WorkspaceRoot.java:87)
        at org.eclipse.core.internal.resources.WorkspaceRoot.findFilesForLocation(WorkspaceRoot.java:82)
        at org.eclipse.jdt.internal.launching.RuntimeClasspathEntry.getResource(RuntimeClasspathEntry.java:342)
        at org.eclipse.jdt.internal.launching.RuntimeClasspathEntry.resolveToOSPath(RuntimeClasspathEntry.java:513)
        at org.eclipse.jdt.internal.launching.RuntimeClasspathEntry.getLocation(RuntimeClasspathEntry.java:500)
        at runjettyrun.tabs.classpath.ClasspathEntry.getRealPath(ClasspathEntry.java:365)
        at runjettyrun.tabs.classpath.AbstractClasspathEntry.getKey(AbstractClasspathEntry.java:89)
        at runjettyrun.tabs.AbstractClasspathTab.isChecked(AbstractClasspathTab.java:235)
        at runjettyrun.tabs.AbstractClasspathTab$1.isChecked(AbstractClasspathTab.java:174)
        at org.eclipse.jface.viewers.CheckboxTreeViewer.doUpdateItem(CheckboxTreeViewer.java:122)
        at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:118)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
        at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
        at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1029)
        at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:474)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
        at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
        at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2170)
        at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:843)
        at org.eclipse.jface.viewers.AbstractTreeViewer.lambda$0(AbstractTreeViewer.java:820)
        at org.eclipse.jface.viewers.AbstractTreeViewer$$Lambda$55/227036826.run(Unknown Source)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
        at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:795)
        at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:596)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1760)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1770)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1770)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1770)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1770)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalInitializeTree(AbstractTreeViewer.java:1539)
        at org.eclipse.jface.viewers.TreeViewer.internalInitializeTree(TreeViewer.java:772)
        at org.eclipse.jface.viewers.AbstractTreeViewer.lambda$1(AbstractTreeViewer.java:1523)
        at org.eclipse.jface.viewers.AbstractTreeViewer$$Lambda$50/83978548.run(Unknown Source)
        at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1458)
        at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:354)
        at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1419)
        at org.eclipse.jface.viewers.CheckboxTreeViewer.preservingSelection(CheckboxTreeViewer.java:398)
        at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(AbstractTreeViewer.java:1517)
        at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:286)
        at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1696)
        at runjettyrun.tabs.AbstractClasspathTab.refresh(AbstractClasspathTab.java:462)
        at runjettyrun.tabs.AbstractClasspathTab.initializeFrom(AbstractClasspathTab.java:420)
        at org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.initializeFrom(AbstractLaunchConfigurationTabGroup.java:90)
xzer commented 8 years ago

RJR is trying to build the complete classpath entry list and then bind them to the ui components, however in modern web application, there are usually tons of dependenting libs, which causes eclipse hangs up on such operation.

The ideal way is that we should load the classpath entries lazily rather than load them on showing even the classpath tab is not shown.

Thanks very much for your report and I will see whether it is possible to make classpath entry loading lazy.

The current work around is, well, SSD may be helpful, my computer with SSD hangs only 2-3 seconds on showing the configuration.

aaime commented 8 years ago

I do have a SSD on the machine of the report, but the projects I'm working on are some massive beasts (100+ modules, millions of LOC)

xzer commented 8 years ago

Wow.... I think your situation is really rare.

I will try to address this issue, but please wait, or PR please :)

xzer commented 8 years ago

I did a brief research and it seems not impossible, but I need time to make it really work.

xzer commented 8 years ago

Now, I added a experimental option at the rjr's preference page, window->preference->rjr, "lazy load classpath entry status".

I am not sure whether this could help your situation, or there is any other potential issue, but you can try it .

Reinstall your plugin or update it directly via eclipse.

Looking forward to your feedback.

jchristofoli commented 8 years ago

I am having the same issue on a very large project. Tried the new option in preferences and don't see an improvement. On Eclipse Mars OSX

"main" #1 prio=6 os_prio=31 tid=0x000000010101e000 nid=0x160b runnable [0x00007fff5fbfc000]
   java.lang.Thread.State: RUNNABLE
    at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
    at org.eclipse.swt.internal.cocoa.NSTableView.reloadData(NSTableView.java:140)
    at org.eclipse.swt.widgets.Tree.checkItems(Tree.java:359)
    at org.eclipse.swt.widgets.TreeItem.setExpanded(TreeItem.java:1153)
    at org.eclipse.jface.viewers.TreeViewer.setExpanded(TreeViewer.java:301)
    at org.eclipse.ui.dialogs.ContainerCheckedTreeViewer.setExpanded(ContainerCheckedTreeViewer.java:167)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1765)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1773)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1773)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1773)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1773)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalInitializeTree(AbstractTreeViewer.java:1542)
    at org.eclipse.jface.viewers.TreeViewer.internalInitializeTree(TreeViewer.java:790)
    at org.eclipse.jface.viewers.AbstractTreeViewer$5.run(AbstractTreeViewer.java:1525)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1462)
    at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:366)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1423)
    at org.eclipse.jface.viewers.CheckboxTreeViewer.preservingSelection(CheckboxTreeViewer.java:398)
    at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(AbstractTreeViewer.java:1517)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:292)
    at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1701)
    at runjettyrun.tabs.AbstractClasspathTab.refresh(AbstractClasspathTab.java:472)
    at runjettyrun.tabs.AbstractClasspathTab.initializeFrom(AbstractClasspathTab.java:429)
    at org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.initializeFrom(AbstractLaunchConfigurationTabGroup.java:90)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper.initializeFrom(LaunchConfigurationTabGroupWrapper.java:201)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.displayInstanceTabs(LaunchConfigurationTabGroupViewer.java:766)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer$8.run(LaunchConfigurationTabGroupViewer.java:637)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.inputChanged(LaunchConfigurationTabGroupViewer.java:654)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput0(LaunchConfigurationTabGroupViewer.java:615)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput(LaunchConfigurationTabGroupViewer.java:590)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.handleLaunchConfigurationSelectionChanged(LaunchConfigurationsDialog.java:960)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$3.selectionChanged(LaunchConfigurationsDialog.java:573)
    at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:877)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
    at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:874)
    at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1243)
    at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1269)
    at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:265)
    at org.eclipse.jface.util.OpenStrategy.access$5(OpenStrategy.java:259)
    at org.eclipse.jface.util.OpenStrategy$1$2.run(OpenStrategy.java:440)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    - locked <0x000000078f027360> (a org.eclipse.swt.widgets.RunnableLock)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4024)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3700)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:827)
    at org.eclipse.jface.window.Window.open(Window.java:803)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(LaunchConfigurationsDialog.java:1154)
    at org.eclipse.debug.ui.DebugUITools$2.run(DebugUITools.java:619)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:627)
    at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:560)
    at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:82)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4230)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1491)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1514)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1499)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1299)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
    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:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    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:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
xzer commented 8 years ago

When is it slow?

Before my previous fix, it was very slow when you open the launcher configuration window, and then after the fix, it should be faster when you open the launcher configuration window, but it is still slow when you switch to the classpath configuration tab.

It is difficult to fasten the classpath configuration tab base on current source structure, I need more time to find out a way.

jchristofoli commented 8 years ago

Its slow when clicking on the run configuration to view it. Got it to eventually work. I think it was about 20 minutes.

xzer commented 8 years ago

That is completely beyond expectations, perhaps my previous fix has no effect on this issue.

I need more time to discovery the reason at first.

Btw, how many libraries are in your project? And are you using SSD or traditional HDD?