You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "wjjboy (via GitHub)" <gi...@apache.org> on 2024/10/23 07:00:19 UTC
[I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
wjjboy opened a new issue, #33363:
URL: https://github.com/apache/shardingsphere/issues/33363
## Bug Report
### Which version of ShardingSphere did you use?
5.5.0 & 5.5.1
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
Federation SQL executes correctly during concurrent queries
### Actual behavior
Federation SQL executes one by one is correctly, but three query one time Exception occurs.
Exception Trace Message:
`More details: java.sql.SQLException: Operation not allowed after ResultSet closed
at org.apache.shardingsphere.infra.exception.core.external.sql.ShardingSphereSQLException.toSQLException(ShardingSphereSQLException.java:81) ~[shardingsphere-infra-exception-core-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.infra.exception.dialect.SQLExceptionTransformEngine.toSQLException(SQLExceptionTransformEngine.java:54) ~[shardingsphere-infra-exception-dialect-core-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeQuery(ShardingSpherePreparedStatement.java:192) ~[shardingsphere-jdbc-5.5.1.jar!/:5.5.1]
at xxx.ShardingRepository.executeQuery(NodeShardingRepository.java:228)
... 109 common frames omitted
Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) ~[mysql-connector-java-5.1.49.jar!/:5.1.49]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898) ~[mysql-connector-java-5.1.49.jar!/:5.1.49]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887) ~[mysql-connector-java-5.1.49.jar!/:5.1.49]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861) ~[mysql-connector-java-5.1.49.jar!/:5.1.49]
at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:733) ~[mysql-connector-java-5.1.49.jar!/:5.1.49]
at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:6279) ~[mysql-connector-java-5.1.49.jar!/:5.1.49]
at com.zaxxer.hikari.pool.HikariProxyResultSet.next(HikariProxyResultSet.java) ~[HikariCP-4.0.3.jar!/:na]
at org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.stream.JDBCStreamQueryResult.next(JDBCStreamQueryResult.java:54) ~[shardingsphere-infra-executor-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.sharding.merge.common.IteratorStreamMergedResult.next(IteratorStreamMergedResult.java:41) ~[shardingsphere-sharding-core-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.sqlfederation.executor.enumerator.JDBCRowEnumerator.moveNext0(JDBCRowEnumerator.java:60) ~[shardingsphere-sql-federation-executor-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.sqlfederation.executor.enumerator.JDBCRowEnumerator.moveNext(JDBCRowEnumerator.java:56) ~[shardingsphere-sql-federation-executor-5.5.1.jar!/:5.5.1]
at org.apache.calcite.linq4j.EnumerableDefaults.groupBy_(EnumerableDefaults.java:979) ~[calcite-linq4j-1.35.0.jar!/:1.35.0]
at org.apache.calcite.linq4j.EnumerableDefaults.groupBy(EnumerableDefaults.java:781) ~[calcite-linq4j-1.35.0.jar!/:1.35.0]
at org.apache.calcite.linq4j.DefaultEnumerable.groupBy(DefaultEnumerable.java:311) ~[calcite-linq4j-1.35.0.jar!/:1.35.0]
at Baz.bind(Unknown Source) ~[na:na]
at org.apache.shardingsphere.sqlfederation.engine.SQLFederationEngine.executePlan(SQLFederationEngine.java:236) ~[shardingsphere-sql-federation-core-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.sqlfederation.engine.SQLFederationEngine.executeQuery(SQLFederationEngine.java:209) ~[shardingsphere-sql-federation-core-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.driver.executor.engine.DriverExecuteQueryExecutor.executeQuery(DriverExecuteQueryExecutor.java:85) ~[shardingsphere-jdbc-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.driver.executor.engine.facade.standard.StandardDriverExecutorFacade.executeQuery(StandardDriverExecutorFacade.java:94) ~[shardingsphere-jdbc-5.5.1.jar!/:5.5.1]
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeQuery(ShardingSpherePreparedStatement.java:183) ~[shardingsphere-jdbc-5.5.1.jar!/:5.5.1]
... 110 common frames omitted`
### Reason analyze (If you can)
the HikariProxyResultSet is closed by other thread?
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Use SpringBoot + ShardingSphere-JDBC + Hikari + Mysql
the DataSource is like below:
`
// federation
CacheOption executionPlanCache = new CacheOption(1024, 65535L);
SQLFederationRuleConfiguration federationRuleConfiguration = new SQLFederationRuleConfiguration(true, false, executionPlanCache);
// config
Collection<RuleConfiguration> ruleConfigs = Lists.newArrayList();
ruleConfigs.add(shardingRuleConfig);
ruleConfigs.add(federationRuleConfiguration);
// 构建属性配置
Properties properties = new Properties();
properties.setProperty("sql-show", "true");
properties.setProperty("max-connections-size-per-query", "1");
return ShardingSphereDataSourceFactory.createDataSource(DATABASE_NAME, null, dataSourceMap, ruleConfigs, properties);
`
There has 3DB:
Table A stored in DB1.A
Table B stored in DB2.B DB3.B
We need sql like this:
`
select t1.id, t2.name, t1.num
from (
select id, count(*) as num
from B
group B.id
) t1 left join (
select id, name
from A
) t2 on t1.id = t2.id
`
### Example codes for reproduce this issue (such as a github link).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "wjjboy (via GitHub)" <gi...@apache.org>.
wjjboy commented on issue #33363:
URL: https://github.com/apache/shardingsphere/issues/33363#issuecomment-2435118194
> Hi @wjjboy, thank you for your feedback. Can you provide a demo to help reproduce this exception?
Demo is in https://github.com/wjjboy/ShardingSphereTest.git
you should modify ShardingRepository.java for mysql username and password, and the db init sql is in resources dir.
The one by one test is in FederationSuccessTest,
The concurrent test is in FederationExceptionTest.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #33363:
URL: https://github.com/apache/shardingsphere/issues/33363#issuecomment-2812022835
Hi @wjjboy, sorry for late reply. I have fix this bug, you can try with master branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "wjjboy (via GitHub)" <gi...@apache.org>.
wjjboy commented on issue #33363:
URL: https://github.com/apache/shardingsphere/issues/33363#issuecomment-2815108051
> Hi [@wjjboy](https://github.com/wjjboy), sorry for late reply. I have fix this bug, you can try with master branch.
Ok,thanks. I will test it in version 5.5.3
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "zhaojinchao95 (via GitHub)" <gi...@apache.org>.
zhaojinchao95 closed issue #33363: Operation not allowed after ResultSet closed when using SQLFederationEngine
URL: https://github.com/apache/shardingsphere/issues/33363
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "wjjboy (via GitHub)" <gi...@apache.org>.
wjjboy commented on issue #33363:
URL: https://github.com/apache/shardingsphere/issues/33363#issuecomment-2440565619
@strongduanmu Hi, any updates on this issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #33363:
URL: https://github.com/apache/shardingsphere/issues/33363#issuecomment-2436902920
@wjjboy Thank you, I will test it recently.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "wjjboy (via GitHub)" <gi...@apache.org>.
wjjboy commented on issue #33363:
URL: https://github.com/apache/shardingsphere/issues/33363#issuecomment-2431100390
> Hi @wjjboy, thank you for your feedback. Can you provide a demo to help reproduce this exception?
I will attached later
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Operation not allowed after ResultSet closed when using SQLFederationEngine [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #33363:
URL: https://github.com/apache/shardingsphere/issues/33363#issuecomment-2431087844
Hi @wjjboy, thank you for your feedback. Can you provide a demo to help reproduce this exception?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org