shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

java.lang.OutOfMemoryError: GC overhead limit exceeded

Open 794086163 opened this issue 1 year ago • 4 comments

Which version of ShardingSphere did you use?

5.2.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

SQL executed correctly

Actual behavior

java.lang.OutOfMemoryError

Reason analyze (If you can)

When parsing SQL, there is an endless loop!!

image

at org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.extractAndPredicates(java.util.Collection, org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment) (line: 67)
at org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.getAndPredicates(org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment) (line: 50)
at org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.extractAndPredicates(java.util.Collection, org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment) (line: 66)
at org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil.getAndPredicates(org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment) (line: 50)
at org.apache.shardingsphere.sql.parser.sql.common.util.ColumnExtractor.extractColumnSegments(java.util.Collection, java.util.Collection) (line: 72)
at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(java.util.Map, java.util.List, org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement, java.lang.String) (line: 110)
at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(java.util.Map, java.util.List, org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement, java.lang.String) (line: 163)
at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(java.util.Map, java.util.List, org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement, java.lang.String) (line: 146)
at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(java.util.Map, org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement, java.lang.String) (line: 131)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection, java.lang.String, int, int, int, boolean, java.lang.String[ ]) (line: 196)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection, java.lang.String) (line: 160)
at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(java.lang.String) (line: 91)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(java.sql.Connection) (line: 86)
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(java.sql.Connection, java.lang.Integer) (line: 88)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(java.sql.Connection, java.lang.Integer) (line: 59)
at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.prepareStatement(org.apache.ibatis.executor.statement.StatementHandler, org.apache.ibatis.logging.Log, boolean) (line: 94)
at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(org.apache.ibatis.mapping.MappedStatement, java.lang.Object, org.apache.ibatis.session.RowBounds, org.apache.ibatis.session.ResultHandler, org.apache.ibatis.mapping.BoundSql) (line: 68)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(org.apache.ibatis.mapping.MappedStatement, java.lang.Object, org.apache.ibatis.session.RowBounds, org.apache.ibatis.session.ResultHandler, org.apache.ibatis.cache.CacheKey, org.apache.ibatis.mapping.BoundSql) (line: 325)
at org.apache.ibatis.executor.BaseExecutor.query(org.apache.ibatis.mapping.MappedStatement, java.lang.Object, org.apache.ibatis.session.RowBounds, org.apache.ibatis.session.ResultHandler, org.apache.ibatis.cache.CacheKey, org.apache.ibatis.mapping.BoundSql) (line: 156)
at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.query(org.apache.ibatis.mapping.MappedStatement, java.lang.Object, org.apache.ibatis.session.RowBounds, org.apache.ibatis.session.ResultHandler, org.apache.ibatis.cache.CacheKey, org.apache.ibatis.mapping.BoundSql) (line: 165)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

SQL:

select * from test where (id = 1 or id =2) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 )

794086163 avatar Mar 03 '23 08:03 794086163

@794086163 hi,would you want to fix this issue.

FlyingZC avatar Mar 04 '23 10:03 FlyingZC

extractAndPredicates

I don't know why SQL parses like this!! image

794086163 avatar Mar 06 '23 03:03 794086163

@794086163 thanks for fixing this issue, do we have the ETA to merge ur pr?

RoySunnySean007 avatar Dec 29 '23 11:12 RoySunnySean007

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

github-actions[bot] avatar Mar 22 '24 20:03 github-actions[bot]