apache / apache/maven-surefire
[SUREFIRE-1927] JVM exit with Process Exit Code:0 failing builds
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[satellite15](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=satellite15)** opened **[SUREFIRE-1927](https://issues.apache.org/jira/browse/SUREFIRE-1927?redirect=false)** and commented
Builds in docker and in our CI tool (which is a dind solution) are failing randomly with errors such as
```java
mvn install -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B -U -Dmaven.wagon.http.retryhandler.count=6 -Dmaven.repo.local=m2_repository -T1C
```
```java
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project json-util: There are test failures.
[ERROR]
[ERROR] Please refer to /services/util/json/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /services/util/json && /usr/lib/jvm/java-1.8-openjdk/jre/bin/java -javaagent:/services/m2_repository/org/jacoco/org.jacoco.agent/0.8.7/org.jacoco.agent-0.8.7-runtime.jar=destfile=/services/util/json/target/coverage-reports/jacoco-ut.exec -jar /services/util/json/target/surefire/surefirebooter6588274738548295815.jar /services/util/json/target/surefire 2021-07-06T15-27-23_728-jvmRun1 surefire2092561723068008165tmp surefire_62096530731829354626tmp
[ERROR] Process Exit Code: 0
[ERROR] Crashed tests:
[ERROR] R] *********.util.json.formatter.JsonFormatterTest
[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 /services/util/json && /usr/lib/jvm/java-1.8-openjdk/jre/bin/java -javaagent:/services/m2_repository/org/jacoco/org.jacoco.agent/0.8.7/org.jacoco.agent-0.8.7-runtime.jar=destfile=/services/util/json/target/coverage-reports/jacoco-ut.exec -jar /services/util/json/target/surefire/surefirebooter6588274738548295815.jar /services/util/json/target/surefire 2021-07-06T15-27-23_728-jvmRun1 surefire2092561723068008165tmp surefire_62096530731829354626tmp
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ cloudtrail-cep ---
[ERROR] Process Exit Code: 0
[ERROR] Crashed tests:
[ERROR] *********.util.json.formatter.JsonFormatterTest
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:748)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:305)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:265)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
[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.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:200)
```
Sometimes we get a list of Crashed tests, sometimes not.
Our typical CI build uses:
Amazon corretto Java8 1:8.282.08-1
Maven 3.6.3
and runs on Ubuntu:18:04 docker image
We have also observed this using
openjdk version "1.8.0_201"
with Alpine linux 3.9.3
In all cases we see a
```java
[ERROR] Process Exit Code: 0
```
Which doesn't look like an error caused the JVM to exit.
Our source code and our tests do not have any System.exit(0) calls.
My first thoughts were that the tests finished but there is a timing issue with the ForkClient ByeListener getting notified that the JVM has exited. However that doesn't explain the cases when the error occurs and tests are still running which are then listed as crashed tests.
---
**Affects:** 3.0.0-M5
**Attachments:**
- [2021-07-06T15-27-23_728-jvmRun1.dump](https://issues.apache.org/jira/secure/attachment/13030200/2021-07-06T15-27-23_728-jvmRun1.dump) (_3.46 kB_)
Contributor guide
Research direction
Reproduce the failure with the reported Maven command and Java environments, then inspect the attached jvmRun1.dump and the crashed JsonFormatterTest output. Trace the fork lifecycle through ForkStarter and the ForkClient ByeListener, and compare runs where tests are still executing with runs that finish; done means the intermittent exit-code-0 failure is explained and a regression test or verified fix is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100