Bug 118507 - Autobuild churn during classpath init
Summary: Autobuild churn during classpath init
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-29 15:30 EST by John Arthorne CLA
Modified: 2006-02-14 06:24 EST (History)
1 user (show)

See Also:


Attachments
Stack traces (325.07 KB, text/plain)
2005-11-29 15:30 EST, John Arthorne CLA
no flags Details
Possible fix (3.76 KB, patch)
2005-12-15 10:06 EST, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2005-11-29 15:30:15 EST
Build: I20051129

I have been noticing that when an autobuild is needed on startup, it frequently takes a very long time to run, and often stops and restarts several times.  The most painful case is on startup of a self-hosting workspace immediately after upgrading to a new build. Sometimes this takes several minutes for me on a large workspace.

I added some instrumentation to the build manager to track this down, and it turns out the classpath initialization performs many small workspace operations without combining it into a single IWorkspaceRunnable.  A typical sequence of events seems to be:

1) Classpath of project 1 is being initialized.
2) Project.setDescription is called when the dynamic project references are set.
3) An autobuild starts
4) Classpath of project 2 is initialized
5) Project.setDescription is called.  The autobuild is told to quit and the caller waits until autobuild completes.
6) Another autobuild starts.

I believe all these intermediate autobuilds will be wasted because the project classpaths aren't even initialized yet. I.e., there is no point starting an autobuild until all projects in the workspace have their classpaths initialized. Even worse, if the dynamic classpaths have not been set, then the build order might be wrong, and these early builds might be causing build state to be discarded because pre-req projects have not yet been built.

 This can be solved by putting an IWorkspace.run() lower in the stack during classpath initialization, but I don't know the code well enough to suggest what is the best place.  Note that you can batch changes without obtaining any scheduling rules by using IWorkspace.run(IWorkspaceRunnable, null, flags, pm) - this would avoid the risk of introducing deadlocks or concurrency problems in this delicate code.

I will attach a console log from my startup today with my build manager instrumentation turned on.  It creates and logs a fake "Exception" each time the autobuild is interrupted.
Comment 1 John Arthorne CLA 2005-11-29 15:30:45 EST
Created attachment 30807 [details]
Stack traces
Comment 2 John Arthorne CLA 2005-12-01 11:24:14 EST
When I installed today's build, I got the same long series of autobuild interruptions.  When everything settled down, my workspace was full of compile errors of the form "The project cannot be built until its prerequisite foo is built".  This suggests to me that the compile order was wrong at some point and projects were compiled out of order.  A full clean and rebuild was needed to get everthing properly compiling again.
Comment 3 Jerome Lanneluc CLA 2005-12-15 10:06:37 EST
Created attachment 31814 [details]
Possible fix
Comment 4 Jerome Lanneluc CLA 2006-01-06 07:02:42 EST
Released fix to HEAD
Comment 5 John Arthorne CLA 2006-01-06 09:41:03 EST
Great. I've been seeing this occasionally so I'll let you know if I see further problems.
Comment 6 Frederic Fusier CLA 2006-02-14 06:24:03 EST
Code verified for 3.2 M5 using build I20060214-0010.