简体   繁体   English

java.lang.OutOfMemoryError:使用Apache POI读取Excel文件时,超出了GC开销限制

[英]java.lang.OutOfMemoryError: GC overhead limit exceeded" while reading excel file using apache POI

We are reading data from the excel file using Apachi POI, It has 800 rows of input data for our Selenium automation testcases. 我们正在使用Apachi POI从excel文件中读取数据,其中有800行用于Selenium自动化测试用例的输入数据。 We have configured using jenkins and executed the batch jobs and it was working fine for more than a year . 我们已经使用jenkins进行配置并执行了批处理作业,并且可以正常工作超过一年。 but now it shows error that "Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded". 但现在它显示错误“线程“主”中的异常java.lang.OutOfMemoryError:超出了GC开销限制”。 when we increase the JVM memory size as 1024 MB it is working fine. 当我们将JVM内存大小增加为1024 MB时,它可以正常工作。 The excel file size is only 68KB. Excel文件大小仅为68KB。 but it shows GC error. 但显示GC错误。 Could you please help us what is the cause of the issue . 您能帮我们造成问题的原因是什么。 how we can give the pemanent fix for the issue . 我们如何为这个问题提供永久的解决办法。

  1. Total rows in the excel sheet is 800 Excel工作表中的总行数为800
  2. excel sheet file size is 68KB Excel工作表文件大小为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. ...表示您的程序/脚本忙于垃圾回收,并且JVM无法执行任何其他任务。

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. 根据Excessive GC Time and OutOfMemoryError ,如果总时间的 98%用于垃圾回收并且少于2%堆内存得以恢复,则JVM会引发OutOfMemoryError错误。 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

  • Turn off the feature which shows this error message by adding an option through the command line as: 通过在命令行中添加以下选项来关闭显示此错误消息的功能:

     -XX:-UseGCOverheadLimit 
  • Increase the heap size through the command line as: 通过命令行以如下方式增加堆大小:

     -Xmx1g 

Note : The default maximum heap size can't exceed 1GB limit regardless of how much memory is installed on the machine. 注意 :无论计算机上安装了多少内存,默认最大堆大小都不能超过1GB

  • 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 您可以在错误java.lang.OutOfMemoryError中找到详细的讨论:超出了GC开销限制

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.OutOfMemoryError:超出GC开销限制,通过Apache POI读取启用宏的Excel工作表时出错 - java.lang.OutOfMemoryError: GC overhead limit exceeded Error while Reading Macro enabled excel sheet through Apache POI java.lang.OutOfMemoryError:读取大文本文件时超出了GC开销限制 - java.lang.OutOfMemoryError: GC overhead limit exceeded while Reading a Large Text file java.lang.OutOfMemoryError: 使用 itext PdfReader 读取大型 PDF 文件时超出 GC 开销限制 - java.lang.OutOfMemoryError: GC overhead limit exceeded when reading large PDF file using itext PdfReader Java-Apache poi导致java.lang.OutOfMemoryError:超出了GC开销限制 - Java - Apache poi leads to java.lang.OutOfMemoryError: GC overhead limit exceeded Apache POI autoColumnWidth java.lang.OutOfMemoryError:超出GC开销限制 - Apache POI autoColumnWidth java.lang.OutOfMemoryError: GC overhead limit exceeded java.lang.OutOfMemoryError:GC开销限制超出了excel阅读器 - java.lang.OutOfMemoryError: GC overhead limit exceeded excel reader Java PreparedStatement java.lang.OutOfMemoryError:超出了GC开销限制 - Java PreparedStatement java.lang.OutOfMemoryError: GC overhead limit exceeded 詹金斯 java.lang.OutOfMemoryError:超出 GC 开销限制 - Jenkins java.lang.OutOfMemoryError: GC overhead limit exceeded java.lang.OutOfMemoryError:GC开销限制超出了android studio - java.lang.OutOfMemoryError: GC overhead limit exceeded android studio Gridgain:java.lang.OutOfMemoryError:超出了GC开销限制 - Gridgain: java.lang.OutOfMemoryError: GC overhead limit exceeded
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM