当前位置: 首页 > news >正文

mybatis拼接sql导致的oom报错 GC报错

报错1:mybatis拼接过多

java.lang.OutOfMemoryError: GC overhead limit exceeded

具体报错:

nested exception is org.apache.ibatis.builder.BuilderException:
Error evaluating expression 'ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfWhere'.
Cause: org.apache.ibatis.ognl.OgnlException: 
sqlSegment [java.lang.OutOfMemoryError: GC overhead limit exceeded

一看报错内容,有builder,expression,sqlSegment,ognl,就可以推测出,应该是mybatis拼接条件太多,导致内存超了。例如条件in里,code太多,或者id太多。

oracle官方对 java.lang.OutOfMemoryError: GC overhead limit exceeded 解释如下:

Exception in thread thread_name: 
java.lang.OutOfMemoryError: GC Overhead limit exceeded Cause: 
The detail message "GC overhead limit exceeded" indicates that 
the garbage collector is running all the time 
and Java program is making very slow progress. 
After a garbage collection, 
if the Java process is spending more than approximately 98% of its time doing garbage collection 
and if it is recovering less than 2% of the heap 
and has been doing so far the last 5 (compile time constant) consecutive garbage collections, 
then a java.lang.OutOfMemoryError is thrown. 
This exception is typically thrown 
because the amount of live data barely fits into the Java heap having little free space for new allocations.Action: Increase the heap size. 
The java.lang.OutOfMemoryError exception for GC Overhead limit exceeded can be turned off with the command line flag -XX:-UseGCOverheadLimit.

大致意思是说:

频繁的进行内存回收(最起码已经进行了5次连续的垃圾回收),JVM就会曝出java.lang.OutOfMemoryError: GC overhead limit exceeded错误。

解决的办法是:

增加堆大小,启动脚本添加参数-Xmx1024m。

或者 关闭GC Overhead limit:-XX:-UseGCOverheadLimit

但由于这是代码本身引起,而非内存不够的问题。所以不建议去改动堆参数或者关闭GC上限。

具体参考

BuilderException OgnlException sqlSegment nonEmptyOfWher OutOfMemoryError:GC overhead limit exceeded_globalcoding的博客-CSDN博客

报错2:

占位符 

===================分割线======================= 

文章到此已经结束,以下是紫薯补丁

java.lang.OutOfMemoryError: GC overhead limit exceeded

nested exception is org.apache.ibatis.builder.BuilderException:
Error evaluating expression 'ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfWhere'.
Cause: org.apache.ibatis.ognl.OgnlException: 
sqlSegment [java.lang.OutOfMemoryError: GC overhead limit exceeded

Exception in thread thread_name: 
java.lang.OutOfMemoryError: GC Overhead limit exceeded Cause: 
The detail message "GC overhead limit exceeded" indicates that 
the garbage collector is running all the time 
and Java program is making very slow progress. 
After a garbage collection, 
if the Java process is spending more than approximately 98% of its time doing garbage collection 
and if it is recovering less than 2% of the heap 
and has been doing so far the last 5 (compile time constant) consecutive garbage collections, 
then a java.lang.OutOfMemoryError is thrown. 
This exception is typically thrown 
because the amount of live data barely fits into the Java heap having little free space for new allocations.
 
Action: Increase the heap size. 
The java.lang.OutOfMemoryError exception for GC Overhead limit exceeded can be turned off with the command line flag -XX:-UseGCOverheadLimit.

http://www.lryc.cn/news/101264.html

相关文章:

  • 如何通俗理解扩散模型?
  • 【C#】并行编程实战:并行编程中的模式
  • Apache Kafka 入门教程
  • python皮卡丘编程代码教程,用python打印皮卡丘
  • shell脚本:数据库的分库分表
  • AtCoder Beginner Contest 312(A~D)
  • SQL中Partition的相关用法
  • 微服务——Docker
  • 测试|测试用例方法篇
  • 负载均衡的策略有哪些? 负载均衡的三种方式?
  • 二十三章:抗对抗性操纵的弱监督和半监督语义分割的属性解释
  • curator实现的zookeeper可重入锁
  • 抽象工厂模式——产品族的创建
  • 【C语言初阶篇】自定义类型结构体我不允许还有人不会!
  • 重大更新|Sui主网即将上线流动性质押,助力资产再流通
  • day3 驱动开发 c语言编程
  • 【字节跳动青训营】后端笔记整理-3 | Go语言工程实践之测试
  • 【Android】Recyclerview的缓存复用
  • 机器学习:混合高斯聚类GMM(求聚类标签)+PCA降维(3维降2维)习题
  • libuv库学习笔记-processes
  • c++ 给无名形参提供默认值
  • NO1.使用命令行创建Maven工程
  • 深度学习入门(一):神经网络基础
  • 网络知识整理
  • 如何有效地使用ChatGPT写小说讲故事?
  • 原生求生记:揭秘UniApp的原生能力限制
  • 网络编程 IO多路复用 [epoll版] (TCP网络聊天室)
  • 【go-zero】浅析 01
  • 音视频——视频流H264编码格式
  • 【使用深度学习的城市声音分类】使用从提取音频特征(频谱图)中提取的深度学习进行声音分类研究(Matlab代码实现)