Summary
Error message GC overhead limit exceeded means too much time is spent in Java Garbage Collection to reclaim Java memory and not much memory reclaimed successfully.
Error
Some web client users are getting "GC overhead limit exceeded" error.
Cause
The parallel / concurrent collector will throw an
OutOfMemoryError
if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError 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. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit
to the command line, which means no more notifications about lack of progress. Root cause will still be there.Fix
To look at tackling the root cause you may need to apply the sizing guide to your system as to why Java Garbage Collection is not effective for Tomcat. However, if looking for quick workaround and your Java heap memory is already maxed, check if your xmx and xms are at the same value. If the same, try reducing the xms. If the xms and xmx are at different values, you can claim more memory back but trade off is that it could impact performance as GC is more often.
Example:
-Xms1024m -Xmx1024m
change to
-Xms128m -Xmx1024m