We are reading data from the excel file using Apachi POI, It has 800 rows of input data for our Selenium automation testcases. We have configured using jenkins and executed the batch jobs and it was working fine for more than a year . but now it shows error that "Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded". when we increase the JVM memory size as 1024 MB it is working fine. The excel file size is only 68KB. but it shows GC error. Could you please help us what is the cause of the issue . how we can give the pemanent fix for the issue .
- Total rows in the excel sheet is 800
- excel sheet file size is 68KB
Getting error message as:
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded".
Please find the attached screenshot for the refrence
enter image description here
This error message...
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded".
...implies that your program/script is busy in garbage collection and JVM is unable to perform any further task.
As per Excessive GC Time and OutOfMemoryError
OutOfMemoryError error is raised by the JVM if 98% of the total time is spent in garbage collection and less than 2% of the heap memory is recovered. This error is raised to prevent applications from running for an extended period of time while making no progress in absence of heap memory.
Solution
Note: The default maximum heap size can't exceed 1GB limit regardless of how much memory is installed on the machine.
Fine tune the Concurrent Collection through the command line as:
-XX:CMSInitiatingOccupancyFraction=<N>
Enable the incremental mode:
-XX:+CMSIncrementalMode
Enable automatic pacing:
-XX:+CMSIncrementalPacing
Finally, ensure that there are no Memory Leaks in your program.
- Most importantly, try to reuse the existing objects whenever and whereever possible to save memory.
You can find a detailed discussion in Error java.lang.OutOfMemoryError: GC overhead limit exceeded