How to debug Out of Memory Heap Space
プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。
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"
setenv and environment variable changes in Bitbucket Server 5.0+
Starting with Bitbucket Server 5.0,
setenv.bat have been removed. The options that were set in this file can now be set via environment variables. Where to set the environment variable depends on which Operating System you're running on.
When using the
atlbitbucket service on Linux, the environment variables are ignored. You must set the parameters in
_start-webapp.sh. These values will be read when the service starts.
As an example, to set
JVM_SUPPORT_RECOMMENDED_ARGS, you would add this line to the file:
Set the parameter as an environment variable for the user running Bitbucket Server. For example, if you want to set
JVM_SUPPORT_RECOMMENDED_ARGS, create it as an environment variable and assign the appropriate value to it. When Bitbucket Server starts using the startup scripts or service, it will pick up and apply this value.
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.