Bug 103540 - [Wizards] New Folder>Advanced>Browse button slow and no busy cursor
Summary: [Wizards] New Folder>Advanced>Browse button slow and no busy cursor
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Billy Biggs CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-07-12 15:19 EDT by Gary CLA
Modified: 2005-10-17 17:23 EDT (History)
3 users (show)

See Also:


Attachments
Suspend the Main thread (198.74 KB, image/pjpeg)
2005-10-07 10:12 EDT, Karice McIntyre CLA
no flags Details
Copy Stack trace (248.73 KB, image/pjpeg)
2005-10-07 10:13 EDT, Karice McIntyre CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gary CLA 2005-07-12 15:19:11 EDT
My aim was to create a linked resource folder in a project.  So I do 
File>New>Folder to bring up the New Folder dialog.  Then I enter a Folder 
Name.  Then I click on the Advanced>> button.  Then I type in the path to a 
directory that contains around 315 items, about 40 of which are directories 
and the rest are symbolic links to directories.  The symbolic links point to 
about 8 different NFS automounted disks.  Then I click on Browse.

There are two problems:

a) It takes several minutes (>5) for the Browse dialog to appear.  I can go to 
that directory and do an "ls -lF" and it takes at most seconds even if none of 
the disks are currently mounted.  So the Browse dialog is very very slow for 
some reason that is apparently not related to having to read the directory, to 
dereference the symbolic links, or to mount the remote disks.

b) The mouse cursor does not change to a watch cursor while Eclipse is busy 
doing this.   Nor is there any other visual feedback that Eclipse is busy and 
is not going to respond until it has finished whatever it may be doing.

Please fix (b) as quickly as possible.
Please fix (a) if at all possible.
Comment 1 Karice McIntyre CLA 2005-10-06 17:25:02 EDT
Which VM are you using?  I think this may be a factor.
Comment 2 Gary CLA 2005-10-06 17:52:52 EDT
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)

Comment 3 Karice McIntyre CLA 2005-10-06 17:59:29 EDT
Are you running self-hosted?  If so, is it possible for you to replicate the 
problem and using the debugger, Suspend the Main process while the Browse 
dialog is trying to come up, then do a Copy Stack and put the trace in the bug 
so we can see which method is causing the hold up?
Comment 4 Gary CLA 2005-10-06 18:09:48 EDT
I follow you up to the Copy Stack.  I do that.  Then what?  I'm finding no way 
to paste or whatever it is that I am supposed to do with whatever I've copied.
Haven't found any documentation for Copy Stack either.
Comment 5 Gary CLA 2005-10-06 18:18:57 EDT
Copy Stack doesn't seem to work.  The Java Stack Trace Console also appears 
nonfunctional.  Here's the top of the stack.  I typed it in.

UnixFileSystem.getBooleanAttributes()(File) line: not available [native method]
UnixFileSystem.getBooleanAttributes(File) line: 228
File.isDirectory() line: 701
FileSystemStructureProvider.isFolder(Object) line:89
MinimizedFileSystemElement.populate(ImportStructureProvider) line:96
MinimizedFileSystemElement.getFiles(ImportStructureProvider) line:46
WizardFileSystemResourceImportPage1.createRootElement
(Object,IImportStructureProvier) line:373
WizardFileSystemResourceImportPage1$9.run()
Comment 6 Karice McIntyre CLA 2005-10-07 10:11:01 EDT
This stack trace is for Importing from the file system.  But the original 
defect report says the problem happens when you create a new folder, click the 
Advanced button, type a directory and click Browse.  

To get the stack, hit the Suspend (looks like a Pause button) in the Debug 
view.  Then select all the stack frames, bring up the context menu and select 
Copy Stack.  The stack should then be on the clipboard for you to paste.  I 
will attach pics.
Comment 7 Karice McIntyre CLA 2005-10-07 10:12:36 EDT
Created attachment 28024 [details]
Suspend the Main thread

First, select the Main thread and Suspend after hitting the Browse button in
the Advanced section of the New Folder wizard.
Comment 8 Karice McIntyre CLA 2005-10-07 10:13:35 EDT
Created attachment 28025 [details]
Copy Stack trace

Then select all the stack frames, bring up the context menu and select Copy
Stack and paste it in this bug.
Comment 9 Gary CLA 2005-10-10 17:19:59 EDT
OS._gtk_file_selection_set_filename(int, int) line: not available [native method]
OS.gtk_file_selection_set_filename(int, int) line: 4084
DirectoryDialog.openClassicDialog() line: 215
DirectoryDialog.open() line: 118
CreateLinkedResourceGroup.handleLinkTargetBrowseButtonPressed() line: 289
CreateLinkedResourceGroup.access$8(CreateLinkedResourceGroup) line: 259
CreateLinkedResourceGroup$3.widgetSelected(SelectionEvent) line: 182
TypedListener.handleEvent(Event) line: 90
EventTable.sendEvent(Event) line: 66
Button(Widget).sendEvent(Event) line: 1021
Display.runDeferredEvents() line: 2867
Display.readAndDispatch() line: 2572
WizardDialog(Window).runEventLoop(Shell) line: 809
WizardDialog(Window).open() line: 787
NewWizardAction.run() line: 181
NewWizardAction(Action).runWithEvent(Event) line: 996
ActionContributionItem.handleWidgetSelection(Event, boolean) line: 538
ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 488
ActionContributionItem$5.handleEvent(Event) line: 400
EventTable.sendEvent(Event) line: 66
MenuItem(Widget).sendEvent(Event) line: 1021
Display.runDeferredEvents() line: 2867
Display.readAndDispatch() line: 2572
Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1699
Workbench.runUI() line: 1663
Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 367
PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 143
IDEApplication.run(Object) line: 103
PlatformActivator$1.run(Object) line: 226
EclipseStarter.run(Object) line: 376
EclipseStarter.run(String[], Runnable) line: 163
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: 324
Main.invokeFramework(String[], URL[]) line: 334
Main.basicRun(String[]) line: 278
Main.run(String[]) line: 973
Main.main(String[]) line: 948
Comment 10 Karice McIntyre CLA 2005-10-17 11:38:42 EDT
The directory path that you entered, just before clicking the Browse button:
1. is the path you entered a valid one?
2. is the path one of the symbolic links or one of the directories?  
Comment 11 Gary CLA 2005-10-17 13:06:08 EDT
The path is valid.  It is the path of a directory containing files, 
directories, and several symbolic links to "distant" mount points.  By distant 
I mean that the individual points sometimes take a good while to mount (each 
one takes a good while to mount, so cumulatively they can take a long time to 
mount).
Comment 12 Karice McIntyre CLA 2005-10-17 13:17:18 EDT
A couple more questions (just trying to get all the relevant info):
1. Is it possible for you to try the same thing using Windows, instead of 
Linux, to see if you get a similar result?  
2. What is the build id you are using (you can get this from the About dialog)?

Thanks.
Comment 13 Gary CLA 2005-10-17 14:00:54 EDT
I'm afraid I've no idea how to mount a Unix directory on Windows.  And I've 
never tried to run Eclipse on Windows although it's probably straight forward 
enough.  I don't know if my plugin would work on Windows, it might if I turned 
off all of the interprocess communications but I'd have to fiddle with it for 
a while.  It's whole purpose in life is to talk to a particular Unix 
application running as a separate process.

The build id is l20050627-1435  (3.1.0)  Previous versions of Eclipse do the 
same thing.

I doubt that there is anything "wrong" with the code in Eclipse or the JVM.  
Eclipse wants to know whether each thing in the directory is a file or a 
directory so that it can display the appropriate icon.  So, in Unix terms, it 
will end up doing a stat system call on each object in the directory.  That 
stat will look through any symbolic link and if that link points to a mount 
point then the remote disk will be mounted in response.  The stat won't return 
until the mount succeeds or times out (minutes for a timeout).  Then Eclipse 
will stat the next object in the directory.  N stat's of "slow" mount points 
results in a dialog that is unresponsive (because it is being held in the 
kernel waiting for each successive mount).  I've created my own file brower 
dialog, for use in my plugin's dialog boxes, and I have that dialog do all of 
the stat's with a separate thread.  So the dialog initially displays all 
objects as "?" and when it gets a stat stat result for an object it changes 
the icon appropriately.  In directories, even large ones, with no mounts 
the "?"s turn to file and directory icons before the dialog is even painted.  
In directories with lots of mount points I can sit and watch them turn 
from "?" into icons in short bursts; each burst consisting of one remote mount 
and some number of purely local objects.  To completely solve the problem in 
the normal Eclipse browser would probably involve something similar.  An 
alternative that wouldn't be a fix but that would be an improvement is to 
change the cursor to a busy cursor while the stat's are going on.  Then at 
least the user knows something is happening and that Eclipse hasn't frozen 
up.  Right now the stat's are happening on the UI thread which halts Eclipse 
in its tracks from the user viewpoint.
Comment 14 Karice McIntyre CLA 2005-10-17 16:31:33 EDT
Veronika, Carolyn - I can't replicate the >5min wait time that Gary is 
experiencing so I tried to gather as much info as possible.  I was wondering if 
you could perhaps offer any insight as to what is happening when the 
DirectoryDialog is trying to open in Gary's case.  Does it seem possible that 
the native call 
  OS._gtk_file_selection_set_filename(int, int)
could take so long (see stack trace in comment #9)?
Comment 15 Billy Biggs CLA 2005-10-17 17:23:09 EDT
The dialog shown when you hit Browse is the GTK+ file selection dialog. For your
version of GTK+, we are using the GtkFileSelection widget.  The function
gtk_file_selection_set_filename() populates the dialog, and you are correct that
there are a lot of stat() calls, even for NFS directories.

See this GTK+ bug regarding the GtkFileSelection widget which describes this
problem:

  http://bugzilla.gnome.org/show_bug.cgi?id=59607

The GTK+ file chooser was rewritten in GTK+ 2.4, and Eclipse 3.1 will use this
if you are running under GTK+ 2.4.9 or newer.  This may fix your issue, but I
know some work was also done there to reduce the number of stat() calls.  See:

  http://bugzilla.gnome.org/show_bug.cgi?id=136185

Regardless, I do not think there is anything SWT can do about this problem.  You
should see the same behaviour in any GTK+ application.
Comment 16 Billy Biggs CLA 2005-10-17 17:23:43 EDT
Unfortunately, since this is a GTK+ bug, have to WONTFIX.