Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1382

OutOfMemoryError occurs when JUnit 5 test fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.20
    • 2.20.1
    • None
    • None

    Description

      Steps to reproduce

      1. Check out project "maven-surefire2_20-junit5" from https://wissenstein@gitlab.com/wissenstein/maven-surefire2_20-junit5.git.
      2. Go to the project root (where pom.xml is).
      3. Run the following command:
        mvn -Psurefire2_19_1 clean test

        The project is tested using Surefire Maven plugin version 2.19.1. At the end of the output you can see:

        -------------------------------------------------------
         T E S T S
        -------------------------------------------------------
        Running com.wissenstein.mavensurefirejunit.SimplisticTest
        Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.073 sec <<< FAILURE! - in com.wissenstein.mavensurefirejunit.SimplisticTest
        shouldDeliberatelyFail()  Time elapsed: 0.021 sec  <<< FAILURE!
        org.opentest4j.AssertionFailedError: Test deliberately failed
                at com.wissenstein.mavensurefirejunit.SimplisticTest.shouldDeliberatelyFail(SimplisticTest.java:11)
        
        
        Results :
        
        Failed tests:
          SimplisticTest.shouldDeliberatelyFail:11 Test deliberately failed
        
        Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
        
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 4.583 s
        [INFO] Finished at: 2017-06-06T16:57:35+02:00
        [INFO] Final Memory: 16M/264M
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project maven-surefire2_20-junit5: There are test failures.
        [ERROR]
        [ERROR] Please refer to C:\projects\surefire\maven-surefire2_20-junit5\target\surefire-reports for the individual test results.
        [ERROR] -> [Help 1]
        [ERROR]
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR]
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
      4. Run the following command:
        mvn -Psurefire2_20 clean test

        The project is tested using Surefire Maven plugin version 2.20.

      Actual result

      At the end of the output you can see:

      [INFO] -------------------------------------------------------
      [INFO]  T E S T S
      [INFO] -------------------------------------------------------
      [INFO] Running com.wissenstein.mavensurefirejunit.SimplisticTest
      [INFO]
      [INFO] Results:
      [INFO]
      [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 6.061 s
      [INFO] Finished at: 2017-06-06T17:03:52+02:00
      [INFO] Final Memory: 17M/3028M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Java heap space -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError

      The stack trace is as follows:

      java.lang.OutOfMemoryError: Java heap space
              at java.util.Arrays.copyOf(Arrays.java:3332)
              at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
              at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
              at java.lang.StringBuilder.append(StringBuilder.java:136)
              at org.apache.maven.plugin.surefire.booterclient.output.MultipleFailureException.getLocalizedMessage(MultipleFailureException.java:52)
              at org.apache.maven.plugin.surefire.booterclient.ForkStarter$CloseableCloser.run(ForkStarter.java:200)
              at org.apache.maven.surefire.shade.org.apache.maven.shared.utils.cli.CommandLineUtils$1.call(CommandLineUtils.java:282)
              at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:626)
              at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
              at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:279)
              at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:243)
              at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1077)
              at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:907)
              at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:785)
              at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
              at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
              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.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
              at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
              at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
              at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)

      Expected result

      At the end of the output you should see lines similar to the output in step 3.

      Attachments

        Issue Links

          Activity

            People

              tibordigana Tibor Digana
              wissenstein Oleksij Lupandin
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: