How to debug Out of Memory Heap Space
プラットフォームについて: 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 は除く
Bitbucket Server recently released a change that will significantly reduce the occurrence of Out Of Memory exceptions as part of - BSERV-10100Getting issue details... STATUS .
The following versions contain the fix: 4.14.10, 5.0.8, 5.1.6, 5.2.4, 5.3.2, 5.4.+ and any higher version.
If possible, before proceeding with the troubleshooting, we recommend upgrading to a version including the fix.
問題
Bitbucket Server hangs or behaves unexpectedly. The atlassian-bitbucket.log
will contain an error message like:
2013-11-26 16:32:46,167 ERROR [threadpool:thread-212251] c.a.s.i.c.StateTransferringExecutor Error while processing asynchronous task
java.lang.OutOfMemoryError: Java heap space
診断
Configure Java to produce a heapdump and a thread stack at the same time when it throws an OutOfMemoryError. Heapdumps can be used to determine what was in memory, and thereby find memory leaks and determine what parts of the system are using too much memory. To generate heapdumps/thread stacks on out of memory, add the following argument to your setenv.sh/bat file in the appropriate section:
#
# Occasionally Atlassian Support may recommend that you set some specific JVM arguments. You can use this variable
# below to do that.
#
JVM_SUPPORT_RECOMMENDED_ARGS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/heap/dump"
Bitbucket Server 5.0+ では setenv と環境変数に変更があります
Bitbucket Server 5.0 以降では setenv.sh
と setenv.bat
が取り除かれています。これらのファイルで設定されていたオプションは、環境変数で設定できるようになりました。環境変数の設定場所は、実行先のオペレーティング システムに応じます。
Linux
When using the atlbitbucket
service on Linux, the environment variables are ignored. You must set the parameters in _start-webapp.sh (or start-bitbucket.sh)
. These values will be read when the service starts.
たとえば、 JVM_SUPPORT_RECOMMENDED_ARGS
を設定するには、ファイルに次の行を追加します。
JVM_SUPPORT_RECOMMENDED_ARGS=-XX:+HeapDumpOnOutOfMemoryError
Windows
Bitbucket Server を実行しているユーザーで、パラメーターを環境変数として設定します。たとえば、JVM_SUPPORT_RECOMMENDED_ARGS
を設定したい場合、それを環境変数として作成して適切な値を割り当てます。Bitbucket Server がスタートアップ スクリプトやサービスを利用して起動する際に、この値が取得および適用されます。
Generating a heap dump will create a file that is the same size as your JVM, so if you have allocated 2GB to your JVM's maximum memory size, the heap dump will be 2GB. Please ensure there is adequate space on the drive for this file to be created.
Also, we do not recommend this setting for heaps larger than 2GB, unless it is specifically instructed by Atlassian Support for troubleshooting a specific problem.