XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Implemented
    • 3.0.0
    • 3.0.1
    • None

    Description

      After upgrading from version 2.4 to 3.0.0 our aggregate build (comprising 52 jar/war modules) started failing when run on Travis CI:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.0.0:jar-no-fork (generate-source-jar) on project etl-executor-impl: Error creating source archive: Problem creating jar: Execution exception: Java heap space -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.0.0:jar-no-fork (generate-source-jar) on project etl-executor-impl: Error creating source archive: Problem creating jar: Execution exception
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
          at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:188)
          at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:184)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating source archive: Problem creating jar: Execution exception
          at org.apache.maven.plugins.source.AbstractSourceJarMojo.packageSources(AbstractSourceJarMojo.java:311)
          at org.apache.maven.plugins.source.AbstractSourceJarMojo.packageSources(AbstractSourceJarMojo.java:253)
          at org.apache.maven.plugins.source.AbstractSourceJarMojo.execute(AbstractSourceJarMojo.java:216)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
          ... 11 more
      Caused by: org.codehaus.plexus.archiver.ArchiverException: Problem creating jar: Execution exception
          at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:982)
          at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:650)
          at org.apache.maven.plugins.source.AbstractSourceJarMojo.packageSources(AbstractSourceJarMojo.java:303)
          ... 15 more
      Caused by: java.io.IOException: Execution exception
          at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.close(AbstractZipArchiver.java:807)
          at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:969)
          ... 17 more
      Caused by: java.lang.OutOfMemoryError: Java heap space
          at org.codehaus.plexus.archiver.zip.ByteArrayOutputStream.needNewBuffer(ByteArrayOutputStream.java:121)
          at org.codehaus.plexus.archiver.zip.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:90)
          at org.codehaus.plexus.archiver.zip.OffloadingOutputStream.<init>(OffloadingOutputStream.java:109)
          at org.codehaus.plexus.archiver.zip.OffloadingOutputStream.<init>(OffloadingOutputStream.java:89)
          at org.codehaus.plexus.archiver.zip.DeferredScatterOutputStream.<init>(DeferredScatterOutputStream.java:28)
          at org.codehaus.plexus.archiver.zip.ConcurrentJarCreator$DeferredSupplier.get(ConcurrentJarCreator.java:47)
          at org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator.createDeferred(ParallelScatterZipCreator.java:75)
          at org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator.access$100(ParallelScatterZipCreator.java:54)
          at org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator$1.initialValue(ParallelScatterZipCreator.java:84)
          at org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator$1.initialValue(ParallelScatterZipCreator.java:80)
          at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:180)
          at java.lang.ThreadLocal.get(ThreadLocal.java:170)
          at org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator$2.call(ParallelScatterZipCreator.java:175)
          ... 4 more
      

      I managed to reproduce this locally by comparing the following two commands:

      # Runs fine in under 10 seconds
      MAVEN_OPTS=-Xmx128m mvn -e org.apache.maven.plugins:maven-source-plugin:2.4:jar
      # Fails already after the third module with source code, after some 7 seconds
      MAVEN_OPTS=-Xmx128m mvn -e org.apache.maven.plugins:maven-source-plugin:3.0.0:jar
      

      Our project is closed-source, but I verified the issue can also be reproduced on a large Maven build such as the one of the Jetty project.

      Attachments

        1. compare-plexus-archiver-revisions.sh
          3 kB
          Stephan Schroevers
        2. memory-usage-test.sh
          0.8 kB
          Stephan Schroevers
        3. memory-usage-test-gc-logs.tgz
          13 kB
          Stephan Schroevers
        4. memory-usage-test-gc-logs-maven-3.0.5.tgz
          12 kB
          Stephan Schroevers

        Issue Links

          Activity

            People

              khmarbaise Karl Heinz Marbaise
              stephan202 Stephan Schroevers
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: