java.lang.OutOfMemoryError:超出GC开销限制“使用apache POI读取excel文件时 [英] java.lang.OutOfMemoryError: GC overhead limit exceeded" while reading excel file using apache POI

查看:818
本文介绍了java.lang.OutOfMemoryError:超出GC开销限制“使用apache POI读取excel文件时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Apachi POI从excel文件中读取数据,它为我们的Selenium自动化测试用户提供了800行输入数据。我们已经使用jenkins配置并执行了批处理作业,它工作了一年多。但现在它显示错误线程中的异常主java.lang.OutOfMemoryError:超出GC开销限制。当我们将JVM内存大小增加到1024 MB时,它工作正常。 excel文件大小只有68KB。但它显示GC错误。能否帮助我们解决问题的原因。我们如何能够为这个问题提供永久的解决方案。

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 .


  1. Excel工资单中的总行数为800

  2. excel工作表文件大小为68KB

获取错误消息:

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded".

请找到附件参考的屏幕截图
在此输入图像说明

Please find the attached screenshot for the refrence enter image description here

推荐答案

此错误消息...

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded".

...意味着您的程序/脚本忙于垃圾收集而JVM无法执行任何操作进一步的任务。

...implies that your program/script is busy in garbage collection and JVM is unable to perform any further task.

根据 过多的GC时间和OutOfMemoryError OutOfMemoryError 错误如果在垃圾回收中花费总时间 98% ,则由 JVM 引发> 2%堆内存已恢复。引发此错误是为了防止应用程序长时间运行而在没有堆内存的情况下没有进展。

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.


  • 通过命令行添加选项,关闭显示此错误消息的功能:

  • 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
    



  • 注意:默认的最大堆大小无论机器上安装了多少内存,都不能超过 1GB 限制。

    Note: The default maximum heap size can't exceed 1GB limit regardless of how much memory is installed on the machine.




    • 通过命令行微调 Concurrent Collection

      -XX:CMSInitiatingOccupancyFraction=<N>
      


    • 启用增量模式:

    • Enable the incremental mode:

      -XX:+CMSIncrementalMode
      


    • 启用自动节奏:

    • Enable automatic pacing:

      -XX:+CMSIncrementalPacing
      


    • 最后,确保没有内存泄漏

      您可以在错误java.lang.OutOfMemoryError:超出GC开销限制

      这篇关于java.lang.OutOfMemoryError:超出GC开销限制“使用apache POI读取excel文件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆