Bug 190013 - [dstore][regression] Right-click > Move on a file is extremely slow and blocks the UI
Summary: [dstore][regression] Right-click > Move on a file is extremely slow and block...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P1 critical (vote)
Target Milestone: 2.0   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 190803
  Show dependency tree
 
Reported: 2007-05-30 15:50 EDT by Martin Oberhuber CLA
Modified: 2008-08-13 13:20 EDT (History)
0 users

See Also:
mober.at+eclipse: review+


Attachments
patch so that directories that are the filter directory match the filter (1.09 KB, patch)
2007-06-01 12:14 EDT, David McKnight CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-05-30 15:50:08 EDT
When trying to reproduce bug #164118, I connected to a Solaris dstore-unix server. Selected a *.txt file in the "My Home" folder (/folk/mober), chose Right-click > Move.

RSE curser turns into a sandclock and won't wake up again. After what seems like ages, it brings up a dialog: "Move Resource, Select Move destination".

In this dialog, all the folders below /folk are listed. It seems that this is the reason why it took so long -- by expanding /folk, it apparently did queries on NFS file systems that would not have been necessary. The dialog should have shown a view similar to the Remote Systems Treeview, with the "My Home" filter but not trying to refresh parents of my home.

I chose a move destination by accident, and got a dialog "Moving..." which does have a cancel button, but it is disabled. All of Eclipse is blocked.

Here is backtrace#1 which I took while RSE was busy filling the select dialog:
Thread [main] (Suspended)	
	Object.wait(long) line: not available [native method]	
	DStoreStatusMonitor.waitForUpdate() line: 380	
	DStoreStatusMonitor.waitForUpdate(DataElement, IProgressMonitor, int) line: 307	
	DStoreStatusMonitor.waitForUpdate(DataElement, IProgressMonitor) line: 249	
	DStoreFileService(AbstractDStoreService).dsQueryCommand(DataElement, ArrayList, String, IProgressMonitor) line: 88	
	DStoreFileService.fetch(String, String, String, IProgressMonitor) line: 1223	
	DStoreFileService.getFilesAndFolders(String, String, IProgressMonitor) line: 1169	
	FileServiceSubSystem.getFilesAndFolders(String, String, IProgressMonitor) line: 293	
	FileServiceSubSystem.listFoldersAndFiles(IRemoteFile, String, IRemoteFileContext, IProgressMonitor) line: 331	
	FileServiceSubSystem(RemoteFileSubSystem).listFoldersAndFiles(IRemoteFile, String, IProgressMonitor) line: 944	
	FileServiceSubSystem(RemoteFileSubSystem).internalResolveOneFilterString(Object, RemoteFileFilterString, boolean, IProgressMonitor) line: 837	
	FileServiceSubSystem(RemoteFileSubSystem).internalResolveFilterString(Object, String, IProgressMonitor) line: 778	
	FileServiceSubSystem(SubSystem).resolveFilterString(Object, String, IProgressMonitor) line: 2123	
	SystemViewRemoteFileAdapter.internalGetChildren(IAdaptable, ISystemFilterReference, IProgressMonitor) line: 722	
	SystemViewRemoteFileAdapter.getChildren(IContextObject, IProgressMonitor) line: 597	
	SystemViewLabelAndContentProvider.getChildren(Object) line: 340	
	SystemView(AbstractTreeViewer).getRawChildren(Object) line: 1302	
	SystemView(TreeViewer).getRawChildren(Object) line: 366	
	SystemView(AbstractTreeViewer).getFilteredChildren(Object) line: 615	
	SystemView(AbstractTreeViewer).getSortedChildren(Object) line: 581	
	SystemView.access$4(SystemView, Object) line: 1	
	SystemView$7.run() line: 5891	
	BusyIndicator.showWhile(Display, Runnable) line: 67	
	SystemView.createChildren(Widget) line: 5872	
	SystemView.expandTo(Object, Object) line: 5520	
	SystemResourceSelectionForm.setPreSelection(Object) line: 352	
	SystemRemoteFolderDialog(SystemRemoteResourceDialog).initForm() line: 79	
	SystemRemoteFolderDialog(SystemRemoteResourceDialog).createInner(Composite) line: 53	
	SystemRemoteFolderDialog(SystemPromptDialog).createDialogArea(Composite) line: 1248	
	SystemRemoteFolderDialog(Dialog).createContents(Composite) line: 752	
	SystemRemoteFolderDialog(SystemPromptDialog).createContents(Composite) line: 1127	
	SystemRemoteFolderDialog(SystemRemoteFileDialog).createContents(Composite) line: 71	
	SystemRemoteFolderDialog(Window).create() line: 426	
	SystemRemoteFolderDialog(Dialog).create() line: 1081	
	SystemRemoteFolderDialog(Window).open() line: 785	
	SystemMoveRemoteFileAction(SystemBaseDialogAction).run() line: 299	
	SystemMoveRemoteFileAction(Action).runWithEvent(Event) line: 498	
	ActionContributionItem.handleWidgetSelection(Event, boolean) line: 545	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 490	
	ActionContributionItem$5.handleEvent(Event) line: 402	
	EventTable.sendEvent(Event) line: 66	
	MenuItem(Widget).sendEvent(Event) line: 938	
	Display.runDeferredEvents() line: 3673	
	Display.readAndDispatch() line: 3284	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2389	
	Workbench.runUI() line: 2353	
	Workbench.access$4(Workbench) line: 2219	
	Workbench$4.run() line: 466	
	Realm.runWithDefault(Realm, Runnable) line: 289	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 461	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 106	
	EclipseAppHandle.run(Object) line: 153	
	EclipseAppLauncher.runApplication(Object) line: 106	
	EclipseAppLauncher.start(Object) line: 76	
	EclipseStarter.run(Object) line: 363	
	EclipseStarter.run(String[], Runnable) line: 176	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 497	
	Main.basicRun(String[]) line: 436	
	Main.run(String[]) line: 1162	
	Main.main(String[]) line: 1137	


And here is backtrace #2 while I'm waiting for the move operation to be done:
Thread [main] (Suspended)	
	Object.wait(long) line: not available [native method]	
	DStoreStatusMonitor.waitForUpdate() line: 380	
	DStoreStatusMonitor.waitForUpdate(DataElement, IProgressMonitor, int) line: 307	
	DStoreStatusMonitor.waitForUpdate(DataElement, IProgressMonitor) line: 249	
	DStoreFileService.copy(String, String, String, String, IProgressMonitor) line: 1070	
	DStoreFileService.move(String, String, String, String, IProgressMonitor) line: 938	
	FileServiceSubSystem.move(IRemoteFile, IRemoteFile, String, IProgressMonitor) line: 618	
	SystemMoveRemoteFileAction.doCopy(Object, Object, String, IProgressMonitor) line: 89	
	SystemMoveRemoteFileAction(SystemBaseCopyAction).run(IProgressMonitor) line: 314	
	ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 369	
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 313	
	ProgressMonitorDialog.run(boolean, boolean, IRunnableWithProgress) line: 495	
	SystemMoveRemoteFileAction(SystemBaseCopyAction).getDialogValue(Dialog) line: 188	
	SystemMoveRemoteFileAction(SystemBaseDialogAction).run() line: 317	
	SystemMoveRemoteFileAction(Action).runWithEvent(Event) line: 498	
	ActionContributionItem.handleWidgetSelection(Event, boolean) line: 545	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 490	
	ActionContributionItem$5.handleEvent(Event) line: 402	
	EventTable.sendEvent(Event) line: 66	
	MenuItem(Widget).sendEvent(Event) line: 938	
	Display.runDeferredEvents() line: 3673	
	Display.readAndDispatch() line: 3284	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2389	
	Workbench.runUI() line: 2353	
	Workbench.access$4(Workbench) line: 2219	
	Workbench$4.run() line: 466	
	Realm.runWithDefault(Realm, Runnable) line: 289	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 461	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 106	
	EclipseAppHandle.run(Object) line: 153	
	EclipseAppLauncher.runApplication(Object) line: 106	
	EclipseAppLauncher.start(Object) line: 76	
	EclipseStarter.run(Object) line: 363	
	EclipseStarter.run(String[], Runnable) line: 176	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 497	
	Main.basicRun(String[]) line: 436	
	Main.run(String[]) line: 1162	
	Main.main(String[]) line: 1137	


In both cases, the Main thread is used for remote operations, thus blocking all of Eclipse. Such operations need to be done in a background job with a progress monitor, and they need to be cancelable in order to keep Eclipse responsive.

I also think that the first issue (being so slow when opening the move destination dialog) is a regression, since I would have noticed this earlier otherwise. Thus marking as critical.

-----------Enter bugs above this line-----------
TM 2.0MRC1 Testing
installation : eclipse-platform-3.3RC1, cdt-4.0M7, emf-2.3M7
RSE install  : workspace HEAD
java.runtime : Sun 1.6.0_01-b06
os.name:     : Windows XP 5.1, Service Pack 1
------------------------------------------------
systemtype   : Dstore-unix
targetos     : Solaris 9
targetuname  : szg-anar
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-05-30 15:52:55 EDT
The dialog even did not go away when I killed the remote server: When killing it, I did get another dialog telling me that the connection was canceled, but the "Move" dialog stayed there, blocking all of Eclipse.

I firmly and honestly believe that all remote operations must be done in background threads; and, the "Move Destination" dialog must be fixed to look as it was in RSE 1.0.1.
Comment 2 Martin Oberhuber CLA 2007-05-30 16:02:14 EDT
When trying this again, I notice that the "Move To" dialog actually did have both the "My Home" and "Root" filters, but it was preselected on the parent directory of my homedirectory: So it had expanded the "Root" filter with a preselection on /folk.

Two problems with this:
* Expanding Root was very slow
* for /folk it's not even correct since no children are shown 

It should have preselected the "My Home" filter as move destination, i.e. the very same directory that I had selected as move source.

Fixing this would fix the regression, then the other issue can probably be deferred to 2.0.1.
Comment 3 David McKnight CLA 2007-05-30 16:20:05 EDT
As far as I know, the move dialog hasn't been looked at in some time so hopefully fixing this will be straight-forward.
Comment 4 David McKnight CLA 2007-05-31 11:28:33 EDT
I don't see a performance issue when I try this.  Is the primary issue here that the expansions are done on the main thread?  One thing about this dialog (in doing pre-selection) is that it avoids deferred queries in order to deal with the widgets directly.  To change that would be dangerous at this point.  Maybe to avoid the performance hit we should not provide preselection in this case.  What do you think?
Comment 5 Martin Oberhuber CLA 2007-05-31 12:41:25 EDT
The primary problem is that way too many remote queries are made, for directories that are not needed and not related to what the dialog should do.

If I wanted to move "My Home"/folder somewhere else, it should preselect "My Home"/folder and nothing else.

It can query the parent directories of "My Home", but given that "My Home" is /folk/mober it should definitely NOT query whether /folk/foobar has children or not. But that's what it has been doing for me, and because /folk contains hundreds of directories in hundreds of file systems potentially far away, the dialog has become unusable.
Comment 6 David McKnight CLA 2007-06-01 12:14:34 EDT
Created attachment 69720 [details]
patch so that directories that are the filter directory match the filter

Martin, does this patch help in your scenario?
Comment 7 Martin Oberhuber CLA 2007-06-04 09:30:01 EDT
Patch is good, please apply -- it fixes the immediate issue.

But when reproducing it, I still fell into other issues, so it's not yet fixed sufficiently. The new issues are being tracked in bug #190803.
Comment 8 David McKnight CLA 2007-06-04 10:26:05 EDT
I've committed the fix.
Comment 9 Martin Oberhuber CLA 2008-08-13 13:20:03 EDT
[target cleanup] 2.0 RC2 was the original target milestone for this bug