Out of Memory Exceptions

Issue

There was an Out of Memory (OOM) exception in your Jenkins environment.  

java.lang.OutOfMemoryError [...]

Environment

  • Jenkins
  • CloudBees Jenkins Enterprise
  • CloudBees Jenkins Operations Center

Resolution

IMPORTANT: If OutOfMemory happens, Jenkins is in the undefined behavior mode. It means that anything may fail, including mission-critical threads in the master. As a result, it does not really make sense to investigate any other observed issue (i.e. connectivity between nodes, any plugin misbehaviour, etc.) before fixing OOM first.

Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. In this case, The garbage collector cannot make space available to accommodate a new object, and the heap cannot be expanded further. Also, this error may be thrown when there is insufficient native memory to support the loading of a Java class. In a rare instance, a java.lang.OutOfMemoryError may be thrown when an excessive amount of time is being spent doing garbage collection and little memory is being freed.

To determine the cause of this exception. The text of the exception includes a detail message. There are different types of OOM Exception as you can see Java 8 - Understand the OutOfMemoryError Exception. From them, we would like to highlight in the Jenkins context ( jenkins.log):

A. Native Memory exhausted

> java.lang.OutOfMemoryError: unable to create new native thread

Solution: Memory problem: ‘unable to create new native thread’

B. PermGen Area exhausted

> java.lang.OutOfMemoryError: PermGen space

Solution: Why do I receive java.lang.OutOfMemoryError: PermGen space

C. Java Heap exhausted

java.lang.OutOfMemoryError
java.lang.OutOfMemoryError: GC overhead limit exceeded
java.lang.OutOfMemoryError: Java heap space

Solution: Java Heap Out of Memory Exception

Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Irmantas Marozas

    Please see the following article:

    Java Heap Out of Memory Exception <--- this is not a hyperlink

  • 0
    Avatar
    Denys Digtiar

    Thank you for letting us know, Irmantas Marozas! We have updated the article.

Please sign in to leave a comment.