Confluence crashes due to 'OutOfMemoryError GC overhead limit exceeded' error
- The system performs slowly or crashes.
- Other unpredictable outcomes can include failed mail, index rebuilding (including searching or Recently Updated problems), user directory synchronization.
-- referer: http://confluence:8090/admin/search-indexes.action | url: /admin/reindex.action | userName: aaa.bbb | action: reindex java.lang.OutOfMemoryError: GC overhead limit exceeded
This error indicates that the JVM is spending too much time in Garbage Collection and not freeing up enough memory. It is often accompanied by high CPU use, as the JVM will be constantly attempting to Garbage Collect, which can require intensive resources. This can lead to Confluence becoming unresponsive, and in some cases can result in the entire server being unresponsive (this will affect all applications on that server).
There are a few different scenarios which can trigger this error:
- GC elapsed time too high
- Too many Full GC iterations
- Too much time spent in GC
If more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError: GC overhead limit exceeded will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small.
It frequently occurs in two very different cases, however:
- The heap is too small and GC is running frequently but is unable to free up enough space.
- The heap is too large, so when a GC occurs, it takes too long to complete.
Refer to How to Enable Garbage Collection (GC) Logging and analyze the GC logs. Compare the used heap after a full GC to the total heap size.
- If these values are close, consider increasing the allocated memory in small increments (512mb or 1gb at a time).
- If the used heap after a full GC is much smaller than the total heap, decrease the heap size. Start with double the used heap after a full GC, and tweak from there if other errors are encountered.
When allocating memory to a JVM, more memory does not always equate to a better experience. An increase in heap size will lead to longer GC times, which can make instances appear frozen when a GC occurs, or can also lead to this error.
See Garbage Collector Performance Issues for more information.