You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Karl Heinz Marbaise (JIRA)" <ji...@apache.org> on 2018/04/22 17:22:00 UTC

[jira] [Comment Edited] (MNG-6398) Multithread Build Hangs Execution with sonar:sonar goal when Aggregator POM references a Child Module as its Parent

    [ https://issues.apache.org/jira/browse/MNG-6398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16447225#comment-16447225 ] 

Karl Heinz Marbaise edited comment on MNG-6398 at 4/22/18 5:21 PM:
-------------------------------------------------------------------

After taking a look in on that I'm the opinion that this build should fail.

The aggregator has a parent which is at the -same time a child module furthermore the child module has a parent which is the aggregator. This is a circular dependency...-

Of course the build should not stuck...it should fail with an appropriate message..


was (Author: khmarbaise):
After taking a look in on that I'm the opinion that this build should fail.

The aggregator has a parent which is at the same time a child module furthermore the child module has a parent which is the aggregator. This is a circular dependency...

Of course the build should not stuck...it should fail with an appropriate message..

> Multithread Build Hangs Execution with sonar:sonar goal when Aggregator POM references a Child Module as its Parent
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-6398
>                 URL: https://issues.apache.org/jira/browse/MNG-6398
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.0.5, 3.2.5, 3.3.9, 3.5.3
>         Environment: Java: 1.8.0_152 (Oracle), MacOS 10.13.4, Locale: en_US, Encoding: UTF-8
>            Reporter: Daniel Johnson
>            Priority: Major
>              Labels: Hanging, Multimodule, aggregator, multithread, multithreading
>         Attachments: maven-hanging-stack.txt, maven-multithread-hanging-sample.zip
>
>
> h1. Problem Statement
> I have an Aggregator POM whose Parent POM is also one of its child Modules. When I run a multi-thread Maven build with normal goals, such as 'clean install' it works as expected; The Parent module builds first followed by the Aggregator.
> However when running '{{mvn sonar:sonar -T 2'}} the build hangs indefinitely (from {{org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905}}).
> h1. Sample Project
> Attached.
> h3. Layout
> {{/pom.xml}}
> {{/parent/pom.xml}}
> h1. Reproducing the Issue
> A normal multi-threaded build should work as expected: {{mvn clean install -T 2}}
> But when running sonar goal, it hangs indefinitely: {{mvn sonar:sonar -T 2}} (This can also be reproduced with {{mvn clean install sonar:sonar -T 2}}, in which case it hangs immediately after building and installing both projects)
> {{DANIJOH2-M-C5DB:deadlock-sample danijoh2$ mvn sonar:sonar -T 2}}
> {{[INFO] Scanning for projects...}}
> {{[INFO] ------------------------------------------------------------------------}}
> {{[INFO] Reactor Build Order:}}
> {{[INFO]}}
> {{[INFO] parent [pom]}}
> {{[INFO] aggregator [pom]}}
> {{[INFO]}}
> {{[INFO] Using the MultiThreadedBuilder implementation with a thread count of 2}}
> {{<process is now hung>}}
> Running the same build with a single thread works fine: {{mvn sonar:sonar}}
> h2. Stack Trace of Hanging Maven Process
> Attached.
> h2. Summary
> I saw the same behavior with Maven 3.0.5, 3.2.3, and 3.3.9, as well with sonar-maven-plugin 3.0 and 3.3.0.603 with the same results. From the stack trace, it seems Maven itself is hung (not deadlocked though), and while it may be caused by the Sonar plugin, it seems the fix likely needs to come from Maven.
> If I make the aggregator itself the parent (and get rid of the parent module entirely) then it works fine. The problem with this approach, is in our project we are also creating aggregated site reports for our project, which if I recall correctly when I tried this last time, the aggregated reports were not always working as expected when the aggregator POM builds before its modules.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)