[ https://issues.apache.org/jira/browse/MSHADE-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17265656#comment-17265656 ]
Bruno Medeiros commented on MSHADE-329: --------------------------------------- > There is no problem running {{mvn}} in single-thread mode. I can confirm this bug, same thing happening here if `-T4C` is added to the build. I'm attaching a thread dump taken while maven build was stuck, we can seem some builder threads in `RUNNABLE` state, but writing to files like crazy. As disabling parallel build seems a very harsh workaround, we are doing this here: {code:java} <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> <configuration> <!-- disabling reduced pom generation due to https://issues.apache.org/jira/browse/MSHADE-329 --> <createDependencyReducedPom>false</createDependencyReducedPom> </configuration> </plugin> {code} I even dare to suggest we disable reduced pom generation by default as most people using it are just generating a uber jar and don't need a pom for that (personal opinion). > Concurrent writes of dependency-reduced-pom.xml adds 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 > Priority: Major > Attachments: mshade-329-thread-dump.txt > > > 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.4#803005)