Bug 182520 - open / close project takes 100 % of the CPU
Summary: open / close project takes 100 % of the CPU
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2007-04-16 04:57 EDT by Eric Jodet CLA
Modified: 2007-05-31 11:31 EDT (History)
4 users (show)

See Also:


Attachments
jvm dumps (375.69 KB, application/x-zip-compressed)
2007-04-16 04:58 EDT, Eric Jodet CLA
no flags Details
Yourkit CPU snapshot (on close project) (1.81 MB, application/x-zip-compressed)
2007-04-16 05:02 EDT, Eric Jodet CLA
no flags Details
Yourkit CPU snapshot (on open project) (1.81 MB, application/x-zip-compressed)
2007-04-16 05:03 EDT, Eric Jodet CLA
no flags Details
package explorer (271.63 KB, image/jpeg)
2007-04-16 05:08 EDT, Eric Jodet CLA
no flags Details
screen shot (228.48 KB, image/jpeg)
2007-04-16 06:40 EDT, Eric Jodet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Jodet CLA 2007-04-16 04:57:20 EDT
Version: 3.3.0
Build id: N20070415-0010

J2RE 5.0 IBM J9 2.3 Windows XP x86-32 build j9vmwi3223-20070201

Found while verifying fix for bug 181900.

Test scenario: same as for bug 181900, open/close org.eclipse.update.configurator project in the monster workspace.
the open / close dialog shows up 5 sec but then, a background job takes 100% of the CPU, and the workstation becomes barely usable until this background job has completed (sometime 3 minutes !)

Taking traces and snapshots leads to a package explorer issue, while trying to update the projects tree.

To be attached files:
1 - jvm dumps
2 - Yourkit snapshots
2 - screen shot
Comment 1 Eric Jodet CLA 2007-04-16 04:58:13 EDT
Created attachment 63873 [details]
jvm dumps
Comment 2 Eric Jodet CLA 2007-04-16 05:02:16 EDT
Created attachment 63874 [details]
Yourkit CPU snapshot (on close project)
Comment 3 Eric Jodet CLA 2007-04-16 05:03:48 EDT
Created attachment 63875 [details]
Yourkit CPU snapshot (on open project)
Comment 4 Eric Jodet CLA 2007-04-16 05:08:10 EDT
Created attachment 63878 [details]
package explorer

Note the 2 identical items in the tree
Comment 5 Martin Aeschlimann CLA 2007-04-16 05:53:35 EDT
The filter updater is a resource listener that looks for changes of the description of projects.
That can be added/removed natures, changed project location, changed project references or a name change.
If it detects one of these, it will refresh the full view, which takes all the time you're observing.

Two problems:
1. I coudn't reproduce the stacktraces as shown in the dumps: Open/close is not a description change. 
Can you maybe set a breakpoint in jdt/ui's FilterUpdater line 46 and maybe find out why the description changed
2. Why do we have the filter updater? I don't know what description change could be interesting. Add/remove nature would result in a Java element deltas, project location and references are uninteresting, changed name will be in normal deltas as well.
Dani do you have an idea?
Comment 6 Martin Aeschlimann CLA 2007-04-16 06:13:04 EDT
I found the reason for comment 5 issue 1.: If a project is referenced through a classpath container the compiler adds a dynamic reference which is removed for closed projects again.

issue 2. seems more interesting to me. I believe we could risk to remove that updater. I don't see which of our filters depends on the refresh.
Comment 7 Eric Jodet CLA 2007-04-16 06:40:56 EDT
Created attachment 63887 [details]
screen shot

Closing project: stopped at line 46 in FilterUpdater
Comment 8 Dani Megert CLA 2007-04-16 09:26:29 EDT
re 2) this is needed because some filters only apply for certain projects, e.g. if a JDT projects becomes a PDE project. Dropping will cause inconsistencies.
Comment 9 Martin Aeschlimann CLA 2007-04-16 12:41:34 EDT
Do you knwo which filters? the one we contribute, do not depend if an additional nature is added.
If other contributions do this, then they probably should be responsible for updating.

The problem is, the 'description' changes happen quite often because of changing dynamic project references.
Comment 10 Dani Megert CLA 2007-04-16 13:03:20 EDT
I have to checke each filter. Adding Dirk, since he added the filter updater.
Comment 11 Dani Megert CLA 2007-04-17 02:52:04 EDT
In the SDK the only filter that would get broken is the BinaryProjectFilter from PDE but other clients that contribute a similar filter (e.g. WTP) might then suffer from the change as well.
Comment 12 Dirk Baeumer CLA 2007-04-17 12:32:38 EDT
A long time ago ;-). I don't remember the problem that got fixed by adding the updater.
Comment 13 Martin Aeschlimann CLA 2007-04-18 11:55:18 EDT
fix released > 20070418

The fix tests if the project description delta really results in different filter behavior.
Only if this is the case, the package explorer is refreshed.
Comment 14 Jerome Lanneluc CLA 2007-05-31 11:31:44 EDT
(In reply to comment #6)
> I found the reason for comment 5 issue 1.: If a project is referenced through a
> classpath container the compiler adds a dynamic reference which is removed for
> closed projects again.
> 
Actually when a project is closed, JDT/Core doesn't remove the reference directly. What you're seeing is expected: when the project is closed, PDE removes the project reference from the Plug-in Dependencies container, and calls JDT/Core to update this container. As a consequence, an IResourceDelta#DESCRIPTION is triggered.