This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new f41d533e7 [MNG-7716] ConcurrencyDependencyGraph deadlock if no root is 
selected
f41d533e7 is described below

commit f41d533e7133968f23664cf8cdde832dd305e16e
Author: Christoph Läubrich <[email protected]>
AuthorDate: Thu Mar 2 17:12:32 2023 +0100

    [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
---
 .../internal/builder/multithreaded/ConcurrencyDependencyGraph.java    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java
 
b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java
index 37c05e666..faa48481e 100644
--- 
a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java
+++ 
b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java
@@ -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);
     }
 

Reply via email to