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

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


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

commit a0f460ca5807bb98561e1ed123fd28302c4fa0f3
Author: Christoph Läubrich <christ...@laeubi-soft.de>
AuthorDate: Thu Mar 2 15:47:34 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 #1027
---
 .../internal/builder/multithreaded/ConcurrencyDependencyGraph.java   | 5 +++++
 1 file changed, 5 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 efa8c2828..1bf569a36 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
@@ -75,6 +75,11 @@ 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