OutOfMemoryError:GC overhead limit exceeded
官方解释报错的原因为:JVM花费了98%的时间进行垃圾回收,而只得到2%可用的内存,频繁的进行内存回收(最起码已经进行了5次连续的垃圾回收),JVM就会曝出ava.lang.OutOfMemoryError: GC overhead limit exceeded错误。
查看报错日志信息
[DUBBO] Got unchecked and undeclared exception which called by 10.18.125.224. service: com.guazi.aftermarket.dubbo.crm.schedule.service.BusinessOpportunityTaskDubboService, method: queryTasksByCustomerId, exception: org.springframework.jdbc.UncategorizedSQLException:
### Error querying database. Cause: java.sql.SQLException: Error
### The error may exist in class path resource [mapping/OpportunityTaskMapper.xml]
### The error may involve com.guazi.aftermarket.crm.schedule.db.mapper.OpportunityTaskMapper.selectByExample-Inline
### The error occurred while setting parameters
定位到问题代码:该方法根据入参customerId查询数据库,做了判空处理。看到这块逻辑上是没问题的

博客详细记录了一次由于大量慢查询导致的Java OutOfMemoryError: GCOverheadLimitExceeded错误。问题源于一个Dubbo接口,该接口执行SQL查询时,因customer_id=0的条件未过滤,导致数十万数据被加载到内存,频繁的垃圾回收无法避免内存溢出。解决方案包括优化SQL,避免全表扫描,增加过滤条件,减少内存负担。

2127

被折叠的 条评论
为什么被折叠?



