OutOfMemory Errors in Bamboo Server or Agents

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

The issue happens every few days. The Bamboo interface shows a job that is just infinitely waiting (that is the spinning circle). The job never times out, and the remote agent logs these:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2012-09-20 13:01:28,198 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-1] [NamedThreadFactory] Uncaught exception in thread AtlassianEvent::0-BAM::EVENTS:pool-2-thread-1 java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) at com.atlassian.bamboo.event.spi.EventInvokerRunnable.run(EventInvokerRunnable.java:23) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52) at java.lang.Thread.run(Thread.java:679) (...) Caused by: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2894) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:117) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:532) at java.lang.StringBuffer.append(StringBuffer.java:323) at java.io.StringWriter.write(StringWriter.java:94) at com.thoughtworks.xstream.core.util.QuickWriter.flush(QuickWriter.java:73) at com.thoughtworks.xstream.core.util.QuickWriter.write(QuickWriter.java:49)
1 2 3 4 2022-03-29 20:25:32,432 ERROR [AgentRunnerThread] [ScanningPluginLoader] Unable to deploy plugin 'org.jfrog.bamboo.bamboo-artifactory-plugin' from 'Unit: /home/bamboo_home/bamboo-agent-home/plugins/user-installed/plugin.65712155610764210.bamboo-artifactory-plugin-3.2.8.jar (1648599893849)'. 2022-03-29 20:25:32,433 ERROR [AgentRunnerThread] [ScanningPluginLoader] Because of the following exception: java.lang.OutOfMemoryError: GC overhead limit exceeded (...)

Cause

The main part of the above error message is "java.lang.OutOfMemoryError: Java heap space" The Bamboo remote agent runs out of Java heap space. Similar errors can also be seen in Bamboo server logs.

Resolution

Setting the Java heap size between 32Gb and 47Gb may result in Java Compressed Oops issues. Check the additional KB article for more information:

Bamboo Remote Agent

Increase the heap size in the <bamboo-agent-home>/conf/wrapper.conf file:

1 2 3 4 # Initial Java Heap Size (in MB) wrapper.java.initmemory=512 # Maximum Java Heap Size (in MB) wrapper.java.maxmemory=1024

Bamboo Elastic Agent

Elastic Agents require additional configuration to modify their Java Heap sizes. Please check the following KB article for details:

Bamboo Server

In case a similar error happens for the Bamboo Server, the heap can be increased from <bamboo-install>/bin/setenv.(sh/bat) file:

1 2 : ${JVM_MINIMUM_MEMORY:=2048m} : ${JVM_MAXIMUM_MEMORY:=2048m}

⚠️After increasing the heap size, a restart is required.

It is hard to guess how much memory should be allocated for the Bamboo server or for remote agents. That's why it's a good idea to increase the default values a little bit in case the error happens and see how that goes.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.