[MNG-7716] ConcurrencyDependencyGraph deadlock if no root is selected

If ConcurrencyDependencyGraph#getRootSchedulableBuilds returns an empty
list then MultiThreadedBuilder is locked forever as it never gets a
build result (because nothing is scheduled).

This changes the method, that in such case just the first project is
returned, this might not give the best performance, but ensures that
there is at least one build scheduled and the build-loop can proceed.

This closes #1029
This commit is contained in:
Christoph Läubrich 2023-03-02 17:12:32 +01:00 committed by Michael Osipov
parent 65d95f08a6
commit f41d533e71
1 changed files with 4 additions and 0 deletions

View File

@ -69,6 +69,10 @@ public class ConcurrencyDependencyGraph {
result.add(projectBuild.getProject());
}
}
if (result.isEmpty() && projectBuilds.size() > 0) {
// Must return at least one project
result.add(projectBuilds.get(0).getProject());
}
return new ArrayList<>(result);
}