You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Håkon Hallingstad (Jira)" <ji...@apache.org> on 2019/09/13 15:53:00 UTC

[jira] [Created] (MSHADE-329) Concurrent writes of dependency-reduced-pom.xml ads same exclusion ad infinitum

Håkon Hallingstad created MSHADE-329:
----------------------------------------

             Summary: Concurrent writes of dependency-reduced-pom.xml ads same exclusion ad infinitum
                 Key: MSHADE-329
                 URL: https://issues.apache.org/jira/browse/MSHADE-329
             Project: Maven Shade Plugin
          Issue Type: Bug
    Affects Versions: 3.2.1
            Reporter: Håkon Hallingstad


I have a multi-threaded {{mvn install}} that seems to halt but ends up using 200% CPU, in about 50% of the invocations. The {{mvn}} command used is:

{panel}
mvn -T1C -nsu -Dmaven.source.skip -Dmaven.javadoc.skip -Dmaven.test.skip install -rf :MODULE
{panel}

Using {{mvnDebug}} I have found out that there are 2 running Java threads, each writing {{dependency-reduced-pom.xml}} in two different modules {{A}} and {{B}}, respectively. These files seems to become several MB large, before they're deleted and then written again, and so forth.

I have looked into one of the threads, and there is a {{rewriteDependencyReducedPomIfWeHaveReduction}} in ShadeMojo with a {{loopCounter}} with value 2735, that just keeps increasing. Presumably there is something like one dependency-reduced-pom.xml written per iteration.

From the source code it seems this can only happen if https://github.com/apache/maven-shade-plugin/blob/master/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java#L1172 is hit at least that number of times, meaning the ShadeMojo adds that many exclusions, which seems to correspond to hamcrest-core:

{noformat}
 <dependencies>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
      <version>4.12</version>
     <scope>test</scope>
    <exclusions>
      <exclusion>
        <artifactId>hamcrest-core</artifactId>
        <groupId>org.hamcrest</groupId>
      </exclusion>
      <exclusion>
        <artifactId>hamcrest-core</artifactId>
        <groupId>org.hamcrest</groupId>
      </exclusion>
     ...
{noformat}

{panel}
grep hamcrest-core dependency-reduced-pom.xml | wc -l
 2735
{panel}

 

The same exclusion is added {{loopCounter}} times in {{updateExcludesInDeps}}.

There is no problem running {{mvn}} in single-thread mode.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)