Docker->Maven->Failsafe->Surefire starting fork fails with "The forked VM terminated without properly saying goodbye. VM crash or System.exit called?" Docker->Maven->Failsafe->Surefire starting fork fails with "The forked VM terminated without properly saying goodbye. VM crash or System.exit called?" docker docker

Docker->Maven->Failsafe->Surefire starting fork fails with "The forked VM terminated without properly saying goodbye. VM crash or System.exit called?"


Try downgrading to Surefire 1.18.1. I ran into this issue tonight and spent a couple hours on it, so far it's not easily apparent why newer builds of Surefire break under Docker.

* Update *

I was having an issue with Alpine linux, but when using an Ubuntu or Debian base image everything was fine. So something within 1.21 is breaking compatibility with certain operating systems.


I have encountered the same issue in the following environment: docker image from alpine 3.7, maven surefire plugin version 2.21.0.

The root cause of that is described at SUREFIRE-1422: surefire tries to use ps -p to check forked process. The solution for me was to add procps:

RUN apk add --no-cache procps


I know it's been a while but will add my solution to the problem which took me more than a day to FIX.

Problem: I'm running my integration tests in the PaaS in a docker container and have no control on the memory allocation for my process. the default behavior is for failsafe/surfire to fork a JVM and run the tests on it. I could not find a way to control the memory allocation for that forked JVM and tests kept failing with the error "Error occurred in starting fork" also saw "The forked VM terminated without saying properly goodbye docker" in the logs depending on which version of failsafe I was trying.

Solution: My solution was to disable forking of the JVM and have all the tests run in the same JVM as the main maven process, now this may not be the ideal solution for many but it would work if you can only control the max memory allocation of the main maven process.

To disable forking it's as simple as setting the forkMode in the config:

<plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-failsafe-plugin</artifactId>    <configuration>        <forkCount>0</forkCount>    </configuration>

.....

UPDATE:Since giving this solution it seems like you can now pass params to the forked JVM so shouldn't need the earlier solution.

From the maven docs under Forked Test Execution:

With the argLine property, you can specify additional parameters to be passed to the forked JVM process, such as memory settings. System property variables from the main maven process are passed to the forked process as well. Additionally, you can use the element systemPropertyVariables to specify variables and values to be added to the system properties during the test execution.

https://maven.apache.org/surefire/maven-failsafe-plugin/examples/fork-options-and-parallel-execution.html