Confluence の Fix java.lang.OutOfMemoryError
プラットフォームについて: Data Center のみ。 - This article only applies to Atlassian apps on the Data Center プラットフォーム。
この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。 Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。
*Fisheye および Crucible は除く
要約
When Confluence Data Center stops working and java.lang.OutOfMemoryError is appearing in the logs, adding memory to the JVM heap 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:
Garbage Collection (GC) Overhead
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. Adjust and monitor memory settings based on system behavior. Regularly check logs for -Xms and -Xmx adjustments and watch for persistent GC delays or OOM errors. If issues continue despite adjustments, generate and analyze heap dumps or contact support.
For reference, the 3 most common parameters used to change the memory (heap) allocation are:
Xms- the minimum size of the heapXmx- the maximum size of the heapXX: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, especially for environments with high memory usage or frequent Garbage Collection (GC) issues (e.g., -Xms4g -Xmx4g or higher). This can improve GC performance and system stability.
It is possible to set the
XmsandXmxvalues as either gigabytes or megabytesWhen setting these values in megabytes, set the value by multiplying the desired memory level by 1024. For example, to set the memory at 2 gigabytes, configure the Xms and Xmx to 2048m (2GB x 1024MB):
-Xms2048m -Xmx2048m同じ例でギガバイトを使う場合は次のようにします。
-Xms2g -Xmx2g⚠️ When setting the value in gigabytes, do not use .5 increments as this will cause the JVM to not start properly
See our Garbage Collection (GC) Tuning Guide for more detailed information.
Add memory to the JVM
Linux
Linux での手順を展開して確認
Add memory in Linux by modifying setenv.sh
Confluence をシャットダウンします。
編集
<confluence-install>/bin/setenv.shFind the line where the node's memory is set
For Xms and Xmx, it should look similar to this
CATALINA_OPTS="[...] -Xms<memory size> -Xmx<memory size> [...] ${CATALINA_OPTS}"For PermGen, it should look similar to this
CATALINA_OPTS="[...] XX:MaxPermSize=<memory size> [...] ${CATALINA_OPTS}"
Increase the values
Xmx is the maximum amount
Xms is the starting amount
Confluence を再起動します。
Windows (starting from a .bat file, not a service)
展開して Windows .bat ファイルの手順を表示
Windows で Confluence をサービスとして起動している場合、この手順は使用せずに後述の「Windows サービス」セクションをご参照ください。
Add memory in Windows by modifying setenv.bat
Confluence をシャットダウンします。
編集
<confluence-install>\bin\setenv.batFind the line where the node's memory is set
For Xms and Xmx, it should look similar to this
CATALINA_OPTS="[...] -Xms<memory size> -Xmx<memory size> [...] ${CATALINA_OPTS}"For PermGen, it should look similar to this
CATALINA_OPTS="[...] XX:MaxPermSize=<memory size> [...] ${CATALINA_OPTS}"
Increase the values
Xmx is the maximum amount
Xms is the starting amount
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この内容はお役に立ちましたか?