You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/09/22 03:48:39 UTC

[GitHub] [shardingsphere] tuohai666 opened a new issue #7549: Operation not allowed after ResultSet closed

tuohai666 opened a new issue #7549:
URL: https://github.com/apache/shardingsphere/issues/7549


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   
   5.0.0-RC1-SNAPSHOT
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Execute transaction correct.
   
   ### Actual behavior
   
   An exception fired when execute a general SQL in local transaction:
   
   ```
   java.sql.SQLException: Operation not allowed after ResultSet closed
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861)
   	at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:743)
   	at com.mysql.jdbc.ResultSetImpl.getMetaData(ResultSetImpl.java:2780)
   	at com.zaxxer.hikari.pool.HikariProxyResultSet.getMetaData(HikariProxyResultSet.java)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.queryresult.StreamQueryResult.<init>(StreamQueryResult.java:45)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.ProxySQLExecutorCallback.createQueryResult(ProxySQLExecutorCallback.java:121)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.ProxySQLExecutorCallback.executeSQL(ProxySQLExecutorCallback.java:87)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.ProxySQLExecutorCallback.executeSQL(ProxySQLExecutorCallback.java:77)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.ProxySQLExecutorCallback.executeSQL(ProxySQLExecutorCallback.java:48)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.executor.impl.DefaultSQLExecutorCallback.execute0(DefaultSQLExecutorCallback.java:75)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.executor.impl.DefaultSQLExecutorCallback.execute(DefaultSQLExecutorCallback.java:57)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorKernel.syncExecute(ExecutorKernel.java:99)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorKernel.serialExecute(ExecutorKernel.java:84)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorKernel.execute(ExecutorKernel.java:78)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.executor.SQLExecutor.execute(SQLExecutor.java:66)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:112)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:105)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:85)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:102)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:85)
   	at org.apache.shardingsphere.proxy.backend.text.admin.UnicastBackendHandler.execute(UnicastBackendHandler.java:62)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:71)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   ```
   
   ### Reason analyze (If you can)
   
   In CommandExecutorTask:
   
   ```
           } finally {
               if (isNeedFlush) {
                   context.flush();
               }
               **Collection<SQLException> exceptions = closeExecutionResources();**
               if (!backendConnection.getTransactionStatus().isInConnectionHeldTransaction()) {
                   exceptions.addAll(backendConnection.closeConnections(false));
               }
               processClosedExceptions(exceptions);
               rootInvokeHook.finish(connectionSize);
           }
   ```
   
   **closeExecutionResources** will close ResultSet and Statement of JDBC. There's no wait notify mechanism for this procedure.
   
   If closeExecutionResources for the previous SQL query doesn't finish, and the next SQL put the ResultSet or Statement into cache, the cache will be cleared by the previous close behavior. The second will throw this exception or a null pointer exception.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #7549: Operation not allowed after ResultSet closed

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #7549:
URL: https://github.com/apache/shardingsphere/issues/7549


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #7549: Operation not allowed after ResultSet closed

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #7549:
URL: https://github.com/apache/shardingsphere/issues/7549


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org