OutOfMemory Errors in Bamboo server or in remote agent

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

症状

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

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)
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
(...)

原因

The main part of the above error message is this: "java.lang.OutOfMemoryError: Java heap space". The bamboo remote agent runs out of Java heap. You could also see similar errors in Bamboo server logs. 

ソリューション

For Bamboo Remote Agent

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

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

For 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:

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

(warning) 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.


Last modified on Mar 31, 2022

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.