Deployment using Bamboo Tomcat deploy and Tomcat restart task plugins causes out of memory exception

お困りですか?

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

コミュニティに質問


プラットフォームについて: 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 は除く

本記事で説明している手順は、現時点でのものとなります。そのため、一部のお客様で特定の状況下で動作したという報告がありますが、正式にサポートされているわけではなく、お客様の特定のシナリオで動作することを保証するものではありません。

本番環境での実施の前に一通り非本番環境で検証し、成功しなかった場合にはサポートされている代替案にフォール バックしてください。

また、アトラシアン サポートのサポート対象外のご質問の場合には、Community もご活用ください。

要約

While deploying a Tomcat based application using Bamboo Tomcat deploy and Tomcat restart task plugins causes out of memory exception in application where the deployment is happening. 

環境

Issue is seen on Bamboo 8.2.4 + Java 7 based external application where deployment was done. Although this issue can be seen on any supported Bamboo version but there are few parameters explained below on the external application side which is applicable only for Java 7 and below versions. 

診断

While using the Bamboo Tomcat deploy and Tomcat restart task plugins to do the deployment on a tomcat based external application, out of memory exception was seen on the external application logs. Below are the error snippet from Bamboo and the external application.

Bamboo deployment logs
Trying to retrieve Tomcat details from Found Tomcat Version: [Apache Tomcat/8.5.69]05-Oct-2022 14:58:53Confirmed Tomcat version: [Apache Tomcat/8.5.69]Could not reload application: Connection resetFinished task 'Tomcat deploy' with result: Error
External application logs
SEVERE [http-nio-18091-exec-37] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method check
java.lang.OutOfMemoryError: PermGen space


原因

The Out of Memory exception as per the error message is coming only on the PermGen space and not the whole Heap, see the structure of heap memory below, Perm space is used to keep informations for loaded classes and few other advanced features like String Pool(for highly optimized string equality testing), which usually get created by String.intern() methods.

As the application(number of classes) will grow this space shall get filled quickly, since the garbage collection on this Space is not much effective to clean up as required, the application quickly get Out of Memory : perm gen space error. After then, no application shall run on that machine effectively even after having a huge empty JVM.

ソリューション

  • The first step is to increase the Perm Gen space by using the below parameter on the external application side
-XX:PermSize=512m -XX:MaxPermSize=1024m

(info) Please replace the values accordingly as applicable for your instance.

  • The next steps is to pass the below 2 flags to the external application JVM 
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled



最終更新日 2022 年 11 月 2 日

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

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