TeslaCN opened a new issue #11390:
URL: https://github.com/apache/shardingsphere/issues/11390
## Bug Report
### Which version of ShardingSphere did you use?
master
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
Proxy
### Expected behavior
### Actual behavior
```
sysbench 1.1.0-ead2689 (using bundled LuaJIT 2.1.0-beta3)
Creating table 'sbtest1'...
Inserting 100000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Creating table 'sbtest2'...
FATAL: `sysbench.cmdline.call_command' function failed: (not a string)
```
```
[ERROR] 2021-07-19 16:20:51.906 [ShardingSphere-Command-4]
o.a.s.p.f.c.CommandExecutorTask - Exception occur:
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedPreparedStatementException:
null
at
org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.prepare.MySQLComStmtPrepareExecutor.execute(MySQLComStmtPrepareExecutor.java:65)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:96)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:72)
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)
[INFO ] 2021-07-19 16:21:32.954 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ:
[id: 0x89603f9c, L:/127.0.0.1:13306 - R:/127.0.0.1:54712]
[INFO ] 2021-07-19 16:21:32.954 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ
COMPLETE
[INFO ] 2021-07-19 16:22:13.980 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ:
[id: 0x5a3c7432, L:/127.0.0.1:13306 - R:/127.0.0.1:54717]
[INFO ] 2021-07-19 16:22:13.980 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ
COMPLETE
[INFO ] 2021-07-19 16:22:55.006 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ:
[id: 0xb1d5113a, L:/127.0.0.1:13306 - R:/127.0.0.1:54733]
[INFO ] 2021-07-19 16:22:55.006 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ
COMPLETE
[INFO ] 2021-07-19 16:29:17.071 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ:
[id: 0x8c1c28e7, L:/127.0.0.1:13306 - R:/127.0.0.1:54836]
[INFO ] 2021-07-19 16:29:17.072 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ
COMPLETE
[INFO ] 2021-07-19 16:29:17.410 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ:
[id: 0x2e49c585, L:/127.0.0.1:13306 - R:/127.0.0.1:54837]
[INFO ] 2021-07-19 16:29:17.410 [nioEventLoopGroup-2-1]
i.n.handler.logging.LoggingHandler - [id: 0x09b5fa67, L:/0.0.0.0:13306] READ
COMPLETE
[ERROR] 2021-07-19 16:29:17.447 [ShardingSphere-Command-13]
o.a.s.p.f.c.CommandExecutorTask - Exception occur:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'sbtest1'
already exists
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2449)
at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:939)
at
com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:103)
at
com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.impl.ProxyStatementExecutorCallback.execute(ProxyStatementExecutorCallback.java:40)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:73)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:66)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:44)
at
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
at
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
at
org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:101)
at
org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:97)
at
org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:82)
at
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:65)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.ProxyJDBCExecutor.execute(ProxyJDBCExecutor.java:71)
at
org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:177)
at
org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:130)
at
org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:119)
at
org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
at
org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
at
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:125)
at
org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
at
org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:57)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:96)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:72)
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)
Schema name in ThreadLocal was not removed. Because the
`MySQLComQueryPacketExecutor` was construct outside of the `try` block. If
exception occurred when constructing the executor the finally block will not be
reached.
### 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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]