How to debug Out of Memory Heap Space

'How Do I...' and 'How to...' Guide to Stash

On this page

In this section

Still need help?

The Atlassian Community is here for you.

Ask the community


Stash hangs or behaves unexpectedly. The atlassian-stash.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 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:OnOutOfMemoryError='kill -3 %p' -XX:HeapDumpPath=/path/to/heap/dump"

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.

Last modified on Feb 23, 2016

Was this helpful?

Provide feedback about this article

In this section

Powered by Confluence and Scroll Viewport.