Caused by: java.sql.SQLException: GC overhead limit exceeded one million data handling exceptions occur

Here is abnormal Windows Tomcat server logs appear:

What is unusual explanation for this problem is that I will not describe, Baidu has a variety of explanations, only talk about how to solve this problem in my operating environment, not the problem, the method functions properly up and running. Springboot project is a simple framework for developing and debugging in eclipse, springboot built using Tomcat to run the project, page test function OK, no more than the exception. The project to fight the war package to deploy to the next Tomcat8 webapps directory, Tomcat8 cost has been set to the Windows system service, start Tomcat8 service, open a browser to view the operation of the project is not paged query all the data display, data My presence here more than 30w , refresh the page does not come out Tomcat8日志 Log appear more abnormal; click export Excel spreadsheet of all the data described above will also abnormal, while the built-in eclipse can run Tomcat8 under normal information display and export data.

Baidu solution:

1, bin files Tomcat8 heads catalina.bat FIG positions plus the following codes: set JAVA_OPTS = -Xms512m -Xmx512m restart after invalid, the still abnormal.

 2, the opening in the bin directory Tomcat8 tomcat8w.exe, Java item selection, modify the value Initial memory pool and Maxmum memmory pool, as shown below:

 Restart Tomcat service, hit run the project, no function test abnormal, everything is running normally, the problem is solved. . . . . .

总结:百度中的一个说法,java.lang.OutOfMemoryError: GC overhead limit exceeded 错误只在连续多次 GC 都只回收了不到2%的极端情况下才会抛出。假如不抛出 GC overhead limit 错误会发生什么情况呢? 那就是GC清理的这么点内存很快会再次填满, 迫使GC再次执行. 这样就形成恶性循环, CPU使用率一直是100%, 而GC却没有任何成果. 系统用户就会看到系统卡死 - 以前只需要几毫秒的操作, 现在需要好几分钟才能完成。

百度中的另一个说法,使用Java程序从数据库中查询大量的数据时出现异常:java.lang.OutOfMemoryError: Java heap space 在JVM中如果98%的时间是用于GC且可用的 Heap size 不足2%的时候将抛出此异常信息。JVM堆的设置是指java程序运行过程中JVM可以调配使用的内存空间的设置.JVM在启动的时候会自动设置Heap size的值,其初始空间(即-Xms)是物理内存的1/64,最大空间(-Xmx)是物理内存的1/4。可以利用JVM提供的-Xmn -Xms -Xmx等选项可进行设置。

贴一个其他博主的解决方案:

在tomcat in的catalina.bat里加
set JAVA_OPTS=-Xms256m -Xmx512m -Djava.awt.headless=true
256和512分别是MIN和MAX内存
在eclipse中的
windows->preferences..->tomcat->jvm..->jvm那一个文本框里,添加-Xms256m -Xmx512m

最后:贴一下帮助解决问题的博主说的解决方案,https://bbs.csdn.net/topics/340266541 以下是原话,希望也能帮到你。。。。。。

Guess you like

Origin www.cnblogs.com/wilmin-xu/p/12098168.html