Confluence の Fix java.lang.OutOfMemoryError

お困りですか?

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

コミュニティに質問

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

要約

When Confluence stops working and java.lang.OutOfMemoryError is appearing in the logs, adding the right amount of memory will get things running again.

Error type and memory size

Java applications like Jira, Crowd, and Confluence run in a "Java virtual machine" (JVM). When started, the JVM is allocated a certain amount of memory, which it makes available to applications like Confluence. By default, JVMs are allocated 64Mb of memory, no matter how many gigabytes of memory your server may actually have available. 64Mb is inadequate for most Confluence installations, so this needs to be increased.

Determine the type of error message

Look in the atlassian-confluence.log to see which type of out-of-memory (OOM) error you're receiving. There are three common messages:

  1. ヒープ領域
  2. PermGen Space
  3. Garbage Collection (GC) Overhead
tip/resting Created with Sketch.

This document discusses increasing memory to address PermGen and Heap space errors. Follow the links above to assess the root cause for each issue.

For GC Overhead, refer to Confluence Crashes Due to 'OutOfMemoryError GC overhead limit exceeded'. Just adding more memory might not solve GC Overhead errors.

利用可能なシステム メモリの決定

Windows の場合

From the Task Manager Dialog (Press ctrl-alt-delete), select the Performance tab.

The amount marked Available is the amount in kilobytes you have free to allocate to Confluence.

Linux の場合

Run this from the shell prompt to view memory usage.

cat /proc/meminfo 

Be sure to leave some free memory unallocated for the operating system to use. If you allocate all available memory on a node, you run the risk of OOM errors, or the entire Confluence JVM could even be killed by the OS to free up memory. Even if that doesn't happen, the node will start swapping memory out to disk. This will severely impact performance.

ガイダンス

The default values supplied with Confluence are sufficient for small installations. Please refer to Managing Application Server Memory Settings and Server Hardware Requirements Guide for more details.

We aren't able to give a concrete recommendation for the amount of memory to allocate because that will depend greatly on your server setup, the size of your user base, and their behavior. You will need to find a value that works for you (no noticeable GC pauses and no OOM errors).

ご参考までに、メモリ (ヒープ) 割り当てを変えるためにもっともよく使用される 3 つのパラメータは次のものです。

  • Xms - the minimum size of the heap
  • Xmx - the maximum size of the heap
  • XX:MaxPermSize - the maximum size of PermGen (this is not used in Java 8 and above)

    Need advice regarding how much memory you should use? Here are some examples of hardware specifications.

If you decide to increase the memory settings, there are a few general guidelines to follow:

Increase Xmx in small increments (1-2GB at a time), until you no longer experience the OOM error

Increasing the heap beyond the capabilities of your server to adequately Garbage Collect can cause performance problems or freezing.

If your error is java.lang.OutOfMemoryError: PermGen space

Increase the XX:MaxPermSize parameter in 256MB increments until the error stops occurring.

If your error does not reference PermGen, there is no need to increase it

PermGen is used to store classes, and is generally quite static in size. It's been removed as of Java 8.

Setting Xms and Xmx

  • Consider setting Xms and Xmx to the same value; this can decrease the time GC takes to occur since it will not attempt to reduce the heap on each collection
  • It is possible to set the Xms and Xmx values as either gigabytes or megabytes
  • これらの値をメガバイトで設定する場合は、意図したメモリ レベルを 1024 で乗算した値を設定します。たとえば、メモリを 2 ギガバイトで設定したい場合、Xms と Xmx を 2048m (2GB x 1024MB) に構成します。
-Xms2048m -Xmx2048m
  • 同じ例でギガバイトを使う場合は次のようにします。
-Xms2g -Xmx2g
  • (warning) When setting the value in gigabytes, do not use .5 increments as this will cause the JVM to not start properly


tip/resting Created with Sketch.

詳細情報については「ガベージ コレクション (GC) チューニング ガイド」をご参照ください。

Add memory to the JVM

Linux

ここをクリックして展開...

Add memory in Linux by modifying setenv.sh

  1. Confluence をシャットダウンします。
  2. <confluence-install>/bin/setenv.sh を編集します。
  3. Find the line where the node's memory is set

    1. For Xms and Xmx, it should look similar to this 

      CATALINA_OPTS="[...] -Xms<memory size> -Xmx<memory size> [...] ${CATALINA_OPTS}"
    2. For PermGen, it should look similar to this 

      CATALINA_OPTS="[...] XX:MaxPermSize=<memory size> [...] ${CATALINA_OPTS}"
  4. Increase the values
    1. Xmx is the maximum amount
    2. Xms is the starting amount
  5. Confluence を再起動します。

Windows (starting from a .bat file, not a service)

ここをクリックして展開...

Windows で Confluence をサービスとして起動している場合、この手順は使用せずに後述の「Windows サービス」セクションをご参照ください。

Add memory in Windows by modifying setenv.bat

  1. Confluence をシャットダウンします。
  2. <confluence-install>\bin\setenv.bat を編集します。
  3. Find the line where the node's memory is set

    1. For Xms and Xmx, it should look similar to this 

      CATALINA_OPTS="[...] -Xms<memory size> -Xmx<memory size> [...] ${CATALINA_OPTS}"
    2. For PermGen, it should look similar to this 

      CATALINA_OPTS="[...] XX:MaxPermSize=<memory size> [...] ${CATALINA_OPTS}"
  4. Increase the values
    1. Xmx is the maximum amount
    2. Xms is the starting amount
  5. Confluence を起動します。

Windows サービス

Follow the instructions in How to set system properties for Confluence running as a service on Windows

Verify your settings

To verify what settings are in place after restarting, check atlassian-confluence.log for the last startup and search for "-Xms" or "-Xmx". 

Alternatively, on Linux, run this to see the environment parameters.

ps -aux | grep java
最終更新日 2024 年 11 月 4 日

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

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