Jenkins Maven Build 137 Error Jenkins Maven Build 137 Error jenkins jenkins

Jenkins Maven Build 137 Error


I was running into the same behavior on our build server. The error is IMHO not associated with the maven memory settings (i.e. MAVEN_OPTS) but rather with the memory of the underlying (Linux) machine itself (which Jenkins runs on).

The (rejected) Jenkins issue https://jenkins-ci.org/issue/12035 gives more detail on this matter:

For reference the status code 137 (128 + 9) typically means (can differ between flavours of unix). That the process was terminated by receipt of a signal. In this case signal 9 which is SIGKILL and unblockable kill.

If this is the case the underlying machine/OS needs more virtual memory. This can be added by either adding physical memory or swap space as appropriate.

You should try to increase the virtual memory of your machine.

Note:
This also explains why a Jenkins restart (temporarily) fixes the issue.


I believe you should increase the values of the memory settings - in MAVEN_OPTS on the Jenkins machine, e.g.

MAVEN_OPTS=-Xmx1.5G -XX:MaxPermSize=0.7G 


If you machine has at least 2 processors and 4GB memory, your JVM will not only grab 1GB at startup but will turn -server mode, meaning memory will be retained for performance sake (source). If you have few JVMs running at the same time (several application components, maven builds etc.) you can easily get into low memory. And one of you JVM may be killed by Linux OOM Killer because you are low on resources on the machine.

Reduce memory footprint of your process which is directly impacted by jvm default Xmx, which most probably is far from what jvm actually need.

Give it additional java command line options

-Xmx256m -XX:MaxPermSize=512m

or configure system variable

MAVEN_OPTS=-Xmx256m -XX:MaxPermSize=512m

MaxPermSize have no use for java 8+