0

I have a Jenkins job that last Friday was working, and since yesterday started to fail. This is my setup

Maven 3.3.9
Oracle JDK 1.8 u144

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.18.1</version>
</plugin>

I tried adding -e and -X options, even increasing log levels, and the only message I see in logs is:

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:9c6abc2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 31 more
Caused by: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?

This is the list of things I have tried (all from Stackoverflow):

  • 3.0.0-M3
  • version 2.21.0
  • reuseForks=false
  • useSystemClassLoader=false
  • trimStackTrace=false
  • argLine=Xmx2048m -XX:MaxPermSize=512m, tried increasing memory because I thought the forked VM was crashing
  • useSystemClassLoader=true and useManifestOnlyJar=false
  • Oracle Java 8 u144
  • Oracle Java 8 u141

Some other thing I noticed is that when the forked JVM is executed, it seems like the "argLine" are not being passed. For example, this is from the logs:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Forking command line: /bin/sh -c cd /data/apps/jenkins/workspace/Build_Deploy_Full_Dev/myapp/core && /data/apps/java/jdk1.8.0_144/jre/bin/java -jar /data/apps/jenkins/workspace/Build_Deploy_Full_Dev/myapp/core/target/surefire/surefirebooter1916960086357827445.jar /data/apps/jenkins/workspace/Build_Deploy_Full_Dev/myapp/core/target/surefire/surefire2156897915383473994tmp /data/apps/jenkins/workspace/Build_Deploy_Full_Dev/myapp/core/target/surefire/surefire_03179213296845219723tmp

As can be seen, the command line to invoke the forked JVM has no arguments. Also, as last clarification, my tests are not invoking any call like "System.exit". I will appreciate any help!

Perimosh
  • 2,304
  • 3
  • 20
  • 38
  • Please check if following link could help: https://stackoverflow.com/questions/23260057/the-forked-vm-terminated-without-saying-properly-goodbye-vm-crash-or-system-exi/53070605 – Anshul Singhal May 30 '19 at 04:22
  • First you have not shown the complete log cause I assume you have failing tests apart from that your output looks strange in particular `org.apache.maven.plugins:maven-surefire-plugin:9c6abc2:test` ..? – khmarbaise May 30 '19 at 12:26
  • No failing tests. The rest of the log is irrelevant, no more errors. – Perimosh May 30 '19 at 12:57
  • @khmarbaise that weird version from my logs was resolved. There were some additional modules that were not specifying the surefire version. Hence maven tried to download the latest version of the plugin from our nexus server. In nexus were some weird 9c6abc2 version, which I can't explain why is was there. Anyway, this is what I did: I deleted my .m2 folder for the surefire plugin, I corrected my pom's to use 2.18.1 version, and then I ran the build again. The same error still happens, but at least it says version 2.18.1 – Perimosh May 31 '19 at 17:57
  • Upgrade surefire plugin to 2.22.2 ...and retry... – khmarbaise May 31 '19 at 19:21
  • any reason to not upgrade to 3.0.0-M3? – Perimosh May 31 '19 at 19:24
  • my bad, you are right, 2.22.2 is the latest – Perimosh May 31 '19 at 19:25
  • Ok, we narrowed down the issue. It is Jenkins. If we execute the mvn build outside Jenkins and even from the same server instance, the build runs fine. – Perimosh May 31 '19 at 21:33
  • 1
    Maybe the OS is killing the spawned VM due to low memory? Jenkins (+child processes, that is, JVM) are obviously memory-hungry. Can you check using `dmesg` from the cmd line? – Daniele Jun 01 '19 at 16:48
  • Unfortunately I don't own this server. I asked the team who owns the server to increase the memory just in case. Thanks! – Perimosh Jun 03 '19 at 17:17

1 Answers1

0

I ran the build from the same server in which Jenkins is installed, but from outside Jenkins, in other words from the command line. I got a successful build, which indicated me that neither maven nor my dependencies were not part of the cause of the problem. After the restart was completed, the build started to work just fine.

Perimosh
  • 2,304
  • 3
  • 20
  • 38