Satya
Satya

Reputation: 171

Jenkins build throwing an out of memory error

We have Jenkins running on an ec2 instance. When doing a build, we see the following error:

17:29:39.149 [INFO] [org.gradle.api.Project] OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000007ac000000, 234881024, 0) failed; error='Cannot allocate memory' (errno=12)
17:29:39.150 [INFO] [org.gradle.api.Project] #

17:29:39.150 [INFO] [org.gradle.api.Project] # There is insufficient memory for the Java Runtime Environment to continue.

17:29:39.150 [INFO] [org.gradle.api.Project] # Native memory allocation (malloc) failed to allocate 234881024 bytes for committing reserved memory.

I researched on this topic and tried various settings such as increasing the heap memory, ram and PermGenSize. Here is my current memory setting on Jenkins:

-Xms256m -Xmx2048m -XX:MaxPermSize=512m

Are there any other things that I'm missing that's causing an OOM?

Upvotes: 17

Views: 18603

Answers (3)

Manas Kumar Maharana
Manas Kumar Maharana

Reputation: 935

if you jules build failing for out of memory then follow below steps:

  1. Increase memory size in manifest.yml file
    Ex- memory:4270 M (increase here)
  2. Add MAVEN_OPTS into config argument of jules.yml file

enter image description here

Enjoy :)

Upvotes: 0

Optio
Optio

Reputation: 7642

I've sold the same problem. (I have ec2, t2.micro, Ubuntu 14, Jenkins, Tomcat, Maven). By default you don't have swap space. To confirm this:

free -m

Just add some. Try with 1 GB for begin.

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Check again:

free -m

For more details look here

Upvotes: 32

Bert Jan Schrijver
Bert Jan Schrijver

Reputation: 1531

This is not a memory issue on JVM level, but on OS level. The JVM tries to allocate 224MB, but this amount of memory isn't available on OS level. This happens when the -Xmx settings of a JVM are larger than the amount of free memory in a system. Check the amount of free memory in the OS, and either limit the memory of your current JVM so that fits within the free memory, or try to free up memory (by limiting the amount of memory other processes use) or try out an EC2 instance with more memory.

Upvotes: 8

Related Questions