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 2022/07/10 03:57:52 UTC

[GitHub] [shardingsphere] terrymanu opened a new issue, #18986: Too board for catch Exception in AddResourceBackendHandler and AlterResourceBackendHandler

terrymanu opened a new issue, #18986:
URL: https://github.com/apache/shardingsphere/issues/18986

   The exception is thrown by:
   
   https://github.com/apache/shardingsphere/blob/1c91f71ec16ed8df1f04c3e8305a892d33b01d63/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AddResourceBackendHandler.java#L65
   
   and
   
   https://github.com/apache/shardingsphere/blob/1c91f71ec16ed8df1f04c3e8305a892d33b01d63/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AlterResourceBackendHandler.java#L70
   
   
   The `ProxyContext.getInstance().getContextManager().updateResources(databaseName, dataSourcePropsMap);`  just throw SQLException, why catch Exception here?
   How about catch SQLException only, or add more exception signature throw?


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


[GitHub] [shardingsphere] RaigorJiang commented on issue #18986: Too board for catch Exception in AddResourceBackendHandler and AlterResourceBackendHandler

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #18986:
URL: https://github.com/apache/shardingsphere/issues/18986#issuecomment-1180157359

   I did some investigation and `ProxyContext.getInstance().getContextManager().updateResources(databaseName, dataSourcePropsMap)` may throw `ShardingSphereException`, which is a type of `RuntimeException`.
   
   Steps to reproduce:
   1. Start Proxy in debug mode;
   2. Execute the Add Resource statement and let the validate method pass smoothly;
   3. Shutdown the target database;
   4. `ProxyContext.getInstance().getContextManager().updateResources(databaseName, dataSourcePropsMap)` will throw `ShardingSphereException`.
   
   The exception information is as follows:
   ```
   org.apache.shardingsphere.infra.exception.ShardingSphereException: Communications link failure
   	at org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine.getDatabaseType(DatabaseTypeEngine.java:113)
   	at org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine.getDatabaseType(DatabaseTypeEngine.java:102)
   	at org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine.lambda$getProtocolType$0(DatabaseTypeEngine.java:52)
   	at java.base/java.util.Optional.orElseGet(Optional.java:364)
   	at org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine.getProtocolType(DatabaseTypeEngine.java:52)
   	at org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory.create(ShardingSphereDatabasesFactory.java:48)
   	at org.apache.shardingsphere.mode.manager.ContextManager.createChangedDatabases(ContextManager.java:314)
   	at org.apache.shardingsphere.mode.manager.ContextManager.updateResources(ContextManager.java:206)
   	at org.apache.shardingsphere.proxy.backend.text.distsql.rdl.resource.AddResourceBackendHandler.execute(AddResourceBackendHandler.java:63)
   	at org.apache.shardingsphere.proxy.backend.text.distsql.rdl.resource.AddResourceBackendHandler.execute(AddResourceBackendHandler.java:44)
   	at org.apache.shardingsphere.proxy.backend.text.DatabaseRequiredBackendHandler.execute(DatabaseRequiredBackendHandler.java:51)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:95)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:108)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
   	at java.base/java.lang.Thread.run(Thread.java:833)
   Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
   	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
   	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
   	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
   	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
   	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
   	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:342)
   	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2197)
   	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2230)
   	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2025)
   	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:778)
   	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
   	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
   	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
   	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
   	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
   	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)
   	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
   	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
   	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:354)
   	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202)
   	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
   	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:554)
   	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
   	at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
   	at org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine.getDatabaseType(DatabaseTypeEngine.java:110)
   	... 16 common frames omitted
   Caused by: java.net.ConnectException: Connection refused
   	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
   	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
   	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549)
   	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
   	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
   	at java.base/java.net.Socket.connect(Socket.java:633)
   	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
   	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:301)
   ```
   


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


[GitHub] [shardingsphere] terrymanu closed issue #18986: Too board for catch Exception in AddResourceBackendHandler and AlterResourceBackendHandler

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #18986: Too board for catch Exception in AddResourceBackendHandler and AlterResourceBackendHandler
URL: https://github.com/apache/shardingsphere/issues/18986


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