Bug Report
Which version of ShardingSphere did you use?
5.1.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
create table t_test_table (
id
varchar(64) NOT NULL,
biz_date
date NOT NULL,
primary key (id, biz_date)
);
we have table like above(mysql), execute the following query(around 2000 ids) shoud be ok
select id from t_test_table where (id = '001' and biz_date='2022-01-01') or (id = '002' and biz_date='2022-02-01')
or (id = '003' and biz_date='2022-02-01') ...
Actual behavior
The above sql cause StackOverFlow:
java.lang.StackOverflowError
at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:47)
at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse0(ShardingSphereSQLParserEngine.java:70)
at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:59)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.(ShardingSpherePreparedStatement.java:167)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.(ShardingSpherePreparedStatement.java:137)
at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:79)
Caused by: java.lang.StackOverflowError
at org.antlr.v4.runtime.CodePointCharStream$CodePoint16BitCharStream.getText(CodePointCharStream.java:215)
at org.antlr.v4.runtime.CommonToken.getText(CommonToken.java:170)
at org.antlr.v4.runtime.tree.TerminalNodeImpl.getText(TerminalNodeImpl.java:54)
at org.antlr.v4.runtime.RuleContext.getText(RuleContext.java:137)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:399)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:220)
at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ExprContext.accept(MySQLStatementParser.java:18210)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.createBinaryOperationExpression(MySQLStatementSQLVisitor.java:405)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:399)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:220)
at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ExprContext.accept(MySQLStatementParser.java:18210)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.createBinaryOperationExpression(MySQLStatementSQLVisitor.java:405)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:399)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:220)
at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ExprContext.accept(MySQLStatementParser.java:18210)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.createBinaryOperationExpression(MySQLStatementSQLVisitor.java:405)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:399)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:220)
at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ExprContext.accept(MySQLStatementParser.java:18210)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.createBinaryOperationExpression(MySQLStatementSQLVisitor.java:405)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:399)
at org.apache.shardingsphere.sql.parser.mysql.visitor.statement.impl.MySQLStatementSQLVisitor.visitExpr(MySQLStatementSQLVisitor.java:220)
at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ExprContext.accept(MySQLStatementParser.java:18210)
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
execute the following sql with around 2000 ids:
select id from t_test_table where (id = '001' and biz_date='2022-01-01') or (id = '002' and biz_date='2022-02-01')
or (id = '003' and biz_date='2022-02-01') ...
Example codes for reproduce this issue (such as a github link).
How about increase your Xss configuration?
How about increase your Xss configuration?
increase stack size means more memory occupied. it is inpredictable.
any other option?
increase stack size means more memory occupied. it is inpredictable.
any other option?
Usually this issue is caused by Xss
too small or SQL too long. Just setting Xss
to a proper value.
Hello , this issue has not received a reply for several days.
This issue is supposed to be closed.