You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/01/17 09:16:09 UTC

[GitHub] joooohnli opened a new issue #1773: Get exceptions while config refreshed through Orchestration

joooohnli opened a new issue #1773: Get exceptions while config refreshed  through Orchestration
URL: https://github.com/apache/incubator-shardingsphere/issues/1773
 
 
   ## 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/sharding-sphere/sharding-sphere/issues).
   - Read documentation: [ShardingSphere Doc](http://shardingsphere.io/document/current/en/overview/).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response **more than 7 days** 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?
   3.1.0
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC
   ### Expected behavior
   no exception
   ### Actual behavior
   2 kinds of exceptions occur:
   ```
   ### Error querying database.  Cause: com.alibaba.druid.pool.DataSourceClosedException: dataSource already closed at Thu Jan 17 16:18:39 CST 2019
   ### The error may exist in class path resource [mapper/BlackMemberMapper.xml]
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: SELECT DISTINCT passiveId FROM BlackMember WHERE memberId = ? AND activeId = ? AND shieldStatus=1 AND project = ?
   ### Cause: com.alibaba.druid.pool.DataSourceClosedException: dataSource already closed at Thu Jan 17 16:18:39 CST 2019
   ; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; dataSource already closed at Thu Jan 17 16:18:39 CST 2019; nested exception is com.alibaba.druid.pool.DataSourceClosedException: dataSource already closed at Thu Jan 17 16:18:39 CST 2019
   	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
   	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
   	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
   	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
   	at com.sun.proxy.$Proxy141.selectList(Unknown Source)
   	at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
   	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)
   	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
   	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
   	at com.sun.proxy.$Proxy144.listActiveBlackMember(Unknown Source)
   	at com.za.blacklist.provider.service.blackmember.impl.BlacklistServiceImpl.listActiveBlackMember(BlacklistServiceImpl.java:118)
   	at com.cz.blacklist.provider.facade.blackmember.BlacklistFacadeImpl.listActiveBlackNotEmpty(BlacklistFacadeImpl.java:148)
   	at com.cz.blacklist.provider.facade.blackmember.BlacklistFacadeImpl.inBlacklist(BlacklistFacadeImpl.java:144)
   	at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java)
   	at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:45)
   	at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:71)
   	at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:48)
   	at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52)
   	at com.za.framework.base.dubbo.filter.ProviderContextFilter.invoke(ProviderContextFilter.java:47)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:61)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:41)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:77)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.filter.ExecuteLimitFilter.invoke(ExecuteLimitFilter.java:59)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:71)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:131)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:37)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:37)
   	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
   	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:102)
   	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
   	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:168)
   	at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:50)
   	at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:79)
   	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)
   Caused by: com.alibaba.druid.pool.DataSourceClosedException: dataSource already closed at Thu Jan 17 16:18:39 CST 2019
   	at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1340)
   	at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1241)
   	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1221)
   	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1211)
   	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:105)
   	at io.shardingsphere.shardingjdbc.jdbc.adapter.AbstractConnectionAdapter.createConnection(AbstractConnectionAdapter.java:169)
   	at io.shardingsphere.shardingjdbc.jdbc.adapter.AbstractConnectionAdapter.createConnections(AbstractConnectionAdapter.java:143)
   	at io.shardingsphere.shardingjdbc.jdbc.adapter.AbstractConnectionAdapter.getConnections(AbstractConnectionAdapter.java:132)
   	at io.shardingsphere.shardingjdbc.executor.PreparedStatementExecutor$1.getConnections(PreparedStatementExecutor.java:77)
   	at io.shardingsphere.core.executor.sql.prepare.SQLExecutePrepareTemplate.getSQLExecuteGroups(SQLExecutePrepareTemplate.java:89)
   	at io.shardingsphere.core.executor.sql.prepare.SQLExecutePrepareTemplate.getSynchronizedExecuteUnitGroups(SQLExecutePrepareTemplate.java:67)
   	at io.shardingsphere.core.executor.sql.prepare.SQLExecutePrepareTemplate.getExecuteUnitGroups(SQLExecutePrepareTemplate.java:59)
   	at io.shardingsphere.shardingjdbc.executor.PreparedStatementExecutor.obtainExecuteGroups(PreparedStatementExecutor.java:73)
   	at io.shardingsphere.shardingjdbc.executor.PreparedStatementExecutor.init(PreparedStatementExecutor.java:68)
   	at io.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.initPreparedStatementExecutor(ShardingPreparedStatement.java:188)
   	at io.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:136)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
   ```
   ```
   [2019-01-17 16:18:39.460 -ERROR] c.g.common.eventbus.EventBus.default     :  - Exception thrown by subscriber method renew(io.shardingsphere.orchestration.internal.registry.state.event.DisabledStateChangedEvent) on subscriber io.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationShardingDataSource@75507e68 when dispatching event: io.shardingsphere.orchestration.internal.registry.state.event.DisabledStateChangedEvent@7b7420ec
   java.lang.ClassCastException: io.shardingsphere.core.rule.MasterSlaveRule cannot be cast to io.shardingsphere.orchestration.internal.rule.OrchestrationMasterSlaveRule
   	at io.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationShardingDataSource.renew(OrchestrationShardingDataSource.java:153)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:95)
   	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:154)
   	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:80)
   	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
   	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:76)
   	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:119)
   	at com.google.common.eventbus.EventBus.post(EventBus.java:215)
   	at io.shardingsphere.orchestration.internal.registry.listener.PostShardingOrchestrationEventListener$1.onChange(PostShardingOrchestrationEventListener.java:54)
   	at io.shardingsphere.orchestration.reg.zookeeper.curator.CuratorZookeeperRegistryCenter$3.childEvent(CuratorZookeeperRegistryCenter.java:231)
   	at org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:730)
   	at org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:724)
   	at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:93)
   	at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:310)
   	at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:85)
   	at org.apache.curator.framework.recipes.cache.TreeCache.callListeners(TreeCache.java:723)
   	at org.apache.curator.framework.recipes.cache.TreeCache.access$1400(TreeCache.java:70)
   	at org.apache.curator.framework.recipes.cache.TreeCache$4.run(TreeCache.java:841)
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   	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)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   1. modify and upload config of one instance (overwrite: true).
   2. another instances(overwrite: false) will get these exceptions after config being refreshed.
   
   Here is the config uploaded:
   ```
   orchestration:
     name: za_blacklist
     overwrite: true
     registry:
       serverLists: xx
       namespace: sharding-jdbc-business
   
   dataSources:
     za_blacklist_m: !!com.alibaba.druid.pool.DruidDataSource
       driverClassName: com.mysql.jdbc.Driver
       url: jdbc:mysql://xx:3306/za_blacklist?serverTimezone=UTC&useSSL=false
       username: xx
       password: xx
       initialSize: 1
       minIdle: 1
       maxActive: 50
       maxWait: 1000
       timeBetweenEvictionRunsMillis: 10000
       minEvictableIdleTimeMillis: 300000
       queryTimeout: 3
       validationQuery: SELECT 1
       testWhileIdle: true
       testOnBorrow: false
       testOnReturn: false
       connectionInitSqls: ["set names utf8mb4;"]
     za_blacklist_s: !!com.alibaba.druid.pool.DruidDataSource
       driverClassName: com.mysql.jdbc.Driver
       url: jdbc:mysql://xx:3306/za_blacklist?serverTimezone=UTC&useSSL=false
       username: xx
       password: xx
       initialSize: 1
       minIdle: 1
       maxActive: 50
       maxWait: 1000
       timeBetweenEvictionRunsMillis: 10000
       minEvictableIdleTimeMillis: 300000
       queryTimeout: 3
       validationQuery: SELECT 1
       testWhileIdle: true
       testOnBorrow: false
       testOnReturn: false
       connectionInitSqls: ["set names utf8mb4;"]
   
   shardingRule:
     masterSlaveRules:
       za_blacklist:
         masterDataSourceName: za_blacklist_m
         slaveDataSourceNames: [za_blacklist_s]
   
     defaultDataSourceName: za_blacklist
   
     tables:
       BlackMember:
         actualDataNodes: za_blacklist.BlackMember_${(0..99).collect(){it.toString().padLeft(2,'0')}}
         tableStrategy:
           inline:
             shardingColumn: memberId
             algorithmExpression: BlackMember_${(memberId % 100).toString().padLeft(2,'0')}
   ```
   
   ### 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 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


With regards,
Apache Git Services