The forked VM terminated without properly saying goodbye while running tests

While running the tests in Circle CI 2.0 we are getting the following Maven error:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.999 s
[INFO] Finished at: 2018-11-02T13:04:28Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project lunch-roulette-be: There are test failures.
[ERROR]
[ERROR] Please refer to /home/circleci/repo/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) 2018-11-02 13:19:13.dump, 2018-11-02 13:19:13-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/circleci/repo && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java ‘-javaagent:/home/circleci/.m2/repository/org/jacoco/org.jacoco.agent/0.8.1/org.jacoco.agent-0.8.1-runtime.jar=destfile=/home/circleci/repo/target/jacoco.exec,excludes=/aspects//:/config//:/model//:/Constants.java:LunchRouletteApplication.java’ -jar /home/circleci/repo/target/surefire/surefirebooter9151248925909865997.jar /home/circleci/repo/target/surefire 2018-11-02T13-04-27_819-jvmRun1 surefire3742721002352156367tmp surefire_05279743039663431819tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/circleci/repo && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java '-javaagent:/home/circleci/.m2/repository/org/jacoco/org.jacoco.agent/0.8.1/org.jacoco.agent-0.8.1-runtime.jar=destfile=/home/circleci/repo/target/jacoco.exec,excludes=
/aspects/
/
:/config//:/model//:**/**Constants.java:LunchRouletteApplication.java’ -jar /home/circleci/repo/target/surefire/surefirebooter9151248925909865997.jar /home/circleci/repo/target/surefire 2018-11-02T13-04-27_819-jvmRun1 surefire3742721002352156367tmp surefire_05279743039663431819tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:978)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:854)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[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/MojoExecutionException

Any ideas?

Many thanks!

1 Like

This is most likely due to a recent change in the openjdk image – we build all changes from upstream images into our images on a build schedule. Your best bet is to find the sha256 digest of the image from your last good build – we have a support center article which should be helpful in doing this, but feel free to ask here if you have any questions or would like a hand, I’ll be happy to help.

1 Like

(Aside: build logs are most readable when pasted in a code block rather than a quote block).

1 Like

That did the trick. Many thanks!
In some point in time I should be able to use the latest openjdk image right?

It depends on whether the impact of the upstream change was a bug or deliberate. It looks like a bug to me, but it is not possible to say without understanding the exact nature of the change.

If you have locked to an image digest then it is certainly a good idea to periodically test new releases to see if they work. If that does not fix it for a long time, it would be worth tracking the bug down to see if you need to do something on your side (e.g. upgrade Maven or change a build file).

Many thanks! I will periodically check new openjdk image releases.

Hi,

What image did you end up using ? I am starting a new project and having the same problem

Hi,

I am using the image from our last successful build, but I’ve read in another topic that circleci/openjdk:8u171-jdk is ok. Probably you should try that one first.

1 Like

Thanks for your answer, however I need java 10

I have solved my problem by editing my surefire maven plugin configuration according to this stackoverflow post :

<build>
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <useSystemClassLoader>false</useSystemClassLoader>
            </configuration>
        </plugin>
    </plugins>
</build>
1 Like

Thanks for pointing that out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.