-
Bug
-
Resolution: Duplicate
-
Blocker
-
None
-
Platform: All, OS: All
When we build a lot of projects, we have sometimes incorrect queue, a some
projects could be builded to fast.
Example:
We have projects: x1, x2, x3, x4.
Project x2 dependes on x1
Project x3 dependes on x1
Project x4 dependes on x2 and x3.
When we start maven build of x1 project, later when the x2 project was builded,
the x4 project is added to the queue and hudson start a build of the x4 project,
but the x3 project now is builded.
The hudson doesn't check downsreams in the actual, in the queue, in progress.
We tried resolve those problems and we tested our changes.
Changes aren't so much pretty, but ...
Changes:
1) class: MavenModuleSetBuild.RunnerImpl
method: cleanUp(...){
if (project.isAggregatorStyleBuild()) {
// schedule downstream builds. for non aggregator style builds,
// this is done by each module
if (getResult().isBetterOrEqualTo(Result.SUCCESS)) {
DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
Queue queue = Hudson.getInstance().getQueue();
queue.executeWait();
for (AbstractProject down : getProject().getDownstreamProjects()) {
if (!graph.hasIndirectDependencies(getProject(), down)
&& !queue.hasIndirectDependenciesWithInProgress(getProject(), down))
}
}
}
performAllBuildStep(listener, project.getPublishers(), false);
performAllBuildStep(listener, project.getProperties(), false);
}
}
2) class: Queue
added method:
@SuppressWarnings("unchecked")
public synchronized boolean
hasIndirectDependenciesWithInProgress(AbstractProject actualProject,
AbstractProject dst) {
Set<AbstractProject> visited = new HashSet<AbstractProject>();
Stack<AbstractProject> queue = new Stack<AbstractProject>();
for (ResourceActivity resourceActivity : inProgress)
if (resourceActivity instanceof AbstractProject)
queue.add((AbstractProject) resourceActivity);
queue.remove(actualProject);
while (!queue.isEmpty())
{ AbstractProject p = queue.pop(); if (p == dst) return true; if (visited.add(p)) queue.addAll(p.getDownstreamProjects()); } return false;
}
3) class: ResourceController
add method:
private boolean _wait = false;
public synchronized void executeWait(){
if(_wait)
try
catch (InterruptedException e) {
}
_wait = true;
}
4) class: ResourceController
change in the method: execute(..)
change from notifyAll() to notify()
- duplicates
-
JENKINS-2736 Inefficient build order for Maven2 projects
- Closed