Bug 215841 - [search] Opening Type Hierarchy extremely slow
Summary: [search] Opening Type Hierarchy extremely slow
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-18 13:50 EST by Stefan Mücke CLA
Modified: 2008-03-26 04:50 EDT (History)
4 users (show)

See Also:


Attachments
Project to reproduce the bug (7.24 KB, application/octet-stream)
2008-01-18 13:50 EST, Stefan Mücke CLA
no flags Details
Proposed patch (4.49 KB, patch)
2008-01-25 12:27 EST, Frederic Fusier CLA
no flags Details | Diff
New proposed patch (7.98 KB, patch)
2008-02-28 07:58 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Mücke CLA 2008-01-18 13:50:34 EST
Created attachment 87284 [details]
Project to reproduce the bug

Build ID: I20071213-1700
Eclipse 3.4 M4 and earlier

Since some time it took extremely long on my system to open the type hierarchy, no matter on which class. Now I found out that the reason was a library referred  to as a linked resource that did no longer exist.

Using Filemon, it turned out that Eclipse obviously tried several times to access and index this jar file. There seems to be a waiting routine between the several tries, since the processor load and the disc activity is very low during the waiting period. During this time, the status bar always showed a message that one file is left to be indexed.

Deleting the respective project solved the problem.

The bug can be reproduced with the attached project (almost empty):

  - Open any workspace

  - Import the attached project using the "Import existing project" wizard

  - Open the Hierarchy view, e.g. on class Widget

  - Now the status line indicates that one file is left to be indexed
    until Eclipse gives up (?) trying to access the library

See .project file for the linked resource.
Comment 1 Dani Megert CLA 2008-01-18 14:47:57 EST
Looks like a JDT Core bug to me. Please move back if not true.
Comment 2 Jerome Lanneluc CLA 2008-01-21 11:18:48 EST
The search scope contains a path to the missing .jar. When creating a type hierarchy, we run multiple search queries, each of them asking for indexes. As a side effect, we attempt to create the missing index for the missing jar.

We should not add a missing .jar in the JavaSearchScope#enclosingProjectsAndJars
Comment 3 Frederic Fusier CLA 2008-01-25 12:27:30 EST
Created attachment 87888 [details]
Proposed patch
Comment 4 Frederic Fusier CLA 2008-01-28 05:27:26 EST
Released for 3.4M5 in HEAD stream.
Comment 5 Maxime Daniel CLA 2008-02-05 06:49:02 EST
Using build I20080204-0010, I find disturbing results.

Considering:
- open brand new workspace;
- import project from the zip file provided as first attachment;
- open type Widget;
- press F4 -- time 1;
- hierarchy appears -- time 2;
- open brand new workspace;
- import plugins org.eclipse.jdt.core, org.eclipse.swt, org.eclipse.swt.win32.win32.x86;
- open type Widget;
- press F4 -- time 3;
- hierarchy appears -- time 4.

time 4 - time 3 is in the second range, while time 2 - time 1 is in the minute range.
Comment 6 Maxime Daniel CLA 2008-02-05 07:02:24 EST
I believe this needs further investigations.
Comment 7 Frederic Fusier CLA 2008-02-05 07:27:23 EST
Agreed.
Comment 8 Frederic Fusier CLA 2008-02-05 09:05:37 EST
The problem comes from the fact that the jar file is a linked resource which does not exist. Unfortunately, my fix and associated test cases does not handle this peculiar case.

It also seems that I missed or forgot to test again the original use case to verify that it was really fixed, sorry for that.

Move the target to M6 as I need some time to figure out what could be the fix in all possible cases (EFS for example)
Comment 9 Frederic Fusier CLA 2008-02-28 07:58:06 EST
Created attachment 90990 [details]
New proposed patch

New strategy to fix this issue: the job (SubTypeSearchJob) now gets the indexes list from its internal set when available instead of always building it from the index locations as done in the superclass (PatternSearchJob). This avoid to request the indexing of the missing jar several times, only valid indexes are used...
Comment 10 Frederic Fusier CLA 2008-02-28 08:00:11 EST
Released for 3.4M6 in HEAD stream.

This time, I have verified that it works also with then project given in the bug description! So, hopefully, we should not fail the next milestone verification...
Comment 11 Eric Jodet CLA 2008-03-26 04:50:47 EDT
Verified for 3.4M6 using build I20080324-1300