0

I'm using CircleCI to run Maven tests in multi-module app. There are some integration tests against servlets which are started with local Jetty server. These tests sometimes randomly crashes on CI only (it's OK on local machine and other developers machines), the error is:

Please refer to /root/project/project-name/target/failsafe-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /root/project/project-name && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -javaagent:/root/.m2/repository/org/jacoco/org.jacoco.agent/0.8.1/org.jacoco.agent-0.8.1-runtime.jar=destfile=/root/project/project-name/target/jacoco-it.exec,output=file -jar /root/project/project-name/target/surefire/surefirebooter1161440693218570841.jar /root/project/project-name/target/surefire 2019-12-10T08-45-37_373-jvmRun1 surefire5250431631797135748tmp surefire_19208522219992515288tmp
Error occurred in starting fork, check output in log
Process Exit Code: 137
Crashed tests:
com.project.name.servlet.InviteServletITCase
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:670)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1161)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1002)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:848)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
    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)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

After crash I've found dumpstream file ./project-name/target/failsafe-reports/2019-12-10T08-45-37_373.dumpstream:

# Created at 2019-12-10T08:46:59.803
Killed

Java version is:

openjdk version "1.8.0_232-ea"
OpenJDK Runtime Environment (build 1.8.0_232-ea-8u232-b09-0ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)

I tried to apply this similar answer: https://stackoverflow.com/a/33757854/1723695 but it doesn't relevant here, since MaxPermSize option is obsolete and will be ignored in Java8, and working machine has enough memory to run tests (tests doesn't consume a lot of memory, 8Gb is more than enough):

$ java -XX:+PrintFlagsFinal -version | grep -i maxheapsize
uintx MaxHeapSize              := 18440257536        {product}

Failsafe plugin configuration in pom.xml is:

        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <groupId>org.apache.maven.plugins</groupId>
          <version>3.0.0-M3</version>
          <configuration>
            <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
            <runOrder>random</runOrder>
            <trimStackTrace>false</trimStackTrace>
            <systemPropertyVariables>
              <!-- some props for tests -->
            </systemPropertyVariables>
          </configuration>
        </plugin>

The failing test is always different, I didn't see that same test failed twice.

Kirill
  • 7,580
  • 6
  • 44
  • 95

0 Answers0