Rupam Kumari
Rupam Kumari

Reputation: 1

While running a build inside Jenkins, I am getting "java/lang/OutOfMemoryError"

2020-02-25 10:11:24.986+0000 [id=79] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started maven-repo-cleanup 2020-02-25 10:11:25.004+0000 [id=79] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished maven-repo-cleanup. 14 ms JVMDUMP039I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" at 2020/02/25 16:31:47 - please wait. JVMDUMP032I JVM requested System dump using 'C:\Users\KumariRupam\Documents\jenkins\core.20200225.163147.3284.0001.dmp' in response to an event JVMDUMP010I System dump written to C:\Users\KumariRupam\Documents\jenkins\core.20200225.163147.3284.0001.dmp JVMDUMP032I JVM requested Heap dump using 'C:\Users\KumariRupam\Documents\jenkins\heapdump.20200225.163147.3284.0002.phd' in response to an event JVMDUMP010I Heap dump written to C:\Users\KumariRupam\Documents\jenkins\heapdump.20200225.163147.3284.0002.phd JVMDUMP032I JVM requested Java dump using 'C:\Users\KumariRupam\Documents\jenkins\javacore.20200225.163147.3284.0003.txt' in response to an event JVMDUMP010I Java dump written to C:\Users\KumariRupam\Documents\jenkins\javacore.20200225.163147.3284.0003.txt JVMDUMP032I JVM requested Snap dump using 'C:\Users\KumariRupam\Documents\jenkins\Snap.20200225.163147.3284.0004.trc' in response to an event JVMDUMP010I Snap dump written to C:\Users\KumariRupam\Documents\jenkins\Snap.20200225.163147.3284.0004.trc JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".

Please help on same.

Upvotes: 1

Views: 3023

Answers (2)

Alexandru Somai
Alexandru Somai

Reputation: 1405

I don't have the full context of your problem, but maybe increasing the allocated memory when you run the Maven build could help:

mvn clean install -DargLine="-Xmx1536m"

Here are some other examples on how to increase the allocated memory:

Upvotes: 1

zett42
zett42

Reputation: 27756

Jenkins Windows setup comes with a 32-bit Java Runtime by default. Swapping that out with a 64-bit version and increasing the available memory through the -Xmx parameter did the trick for me. Jenkins machine is running stable for some months now.

How to replace default 32-bit Java Runtime with a 64-bit one:

  • Download OpenJDK 8 JRE for Windows x64
    • ⚠️ Note: Newer runtime may cause issues with some plugins. See Java requirements.
  • Extract ZIP file to some folder, typically C:\Program Files\Java\JRE8
  • Edit "jenkins.xml" to point to JRE8 (typically located in C:\Program Files (x86)\Jenkins):
    • <executable>C:\Program Files\Java\JRE8\bin\java</executable>

How to increase available memory for Jenkins:

  • Edit "jenkins.xml" to increase argument of parameter -Xmx (typically located in C:\Program Files (x86)\Jenkins):
    • <arguments>-Xrs -Xmx1536m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
    • This is just a sample of my configuration. In my experience 1,5 GiB memory works quite well. You may set -Xmx to a higher value if you still get crashes.

Upvotes: 0

Related Questions