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

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


The following commit(s) were added to refs/heads/maven-3.9.x by this push:
     new 837db7a75 [MNG-7716] ConcurrencyDependencyGraph deadlock if no root is 
selected
837db7a75 is described below

commit 837db7a756164cadd978e53f8c566f0f14b79b6c
Author: Christoph Läubrich <christ...@laeubi-soft.de>
AuthorDate: Thu Mar 2 16:16: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 #1028
---
 .../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