Confluence crashes due to 'OutOfMemoryError Java heap space' error

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Confluence hangs or behaves unexpectedly.

The atlassian-confluence.log will contain an error message like:

java.lang.OutOfMemoryError: Java heap space

Diagnosis

Configure Java to produce a heap dump when it throws an OutOfMemoryError. Heap dumps 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 a heap dump once an out of memory error occurs, add the following arguments to your Confluence as per the Configuring System Properties document:

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<heap_dump_file_path>

Generating a heap dump will create a file that is the same size as your JVM heap, so if you have allocated 2 GB to your JVM's maximum heap size, the heap dump will be 2 GB.

Please ensure there is enough space on the drive or directory defined on the <heap_dump_file_path> 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.

Cause

The Java heap space allocation has been exceeded. This can happen either from a memory leak in the application or from normal usage requiring more memory.

There are several known causes:

  1. The XML Backup is one known memory hog. Check Cannot create or restore XML backup due to OutOfMemory errors.
  2. Heavy usage of the Office Connector or large office files can cause Out Of Memory Errors, for example, CONF-17113.
  3. Using HSQLDB (the evaluation database) can cause memory problems.
  4. Upgrading Confluence from a version pre-3.5 to a version 3.5 or above, if Confluence was already close to using the maximum heap space, as Confluence's memory use increased by about 250 MB with version 3.5.

Resolution

  1. If you're using the XML backup, disable it and use the Production Backup Strategy. Check Cannot create or restore XML backup due to OutOfMemory errors for more information.
  2. Upgrade Confluence - we continue to fix root causes for Out Of Memory Errors.
  3. If you're using the evaluation database, Migrate to a Production Database.
  4. If your usage patterns have increased, you likely just need to tweak your memory settings. See Fix Out of Memory errors by Increasing Available Memory. When increasing heap space, pay attention to Garbage Collection performance.
Last modified on Mar 29, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.