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 2021/09/17 03:00:43 UTC

[GitHub] [shardingsphere] RaigorJiang opened a new issue #12513: [Mode] NPE occurred during Proxy startup.

RaigorJiang opened a new issue #12513:
URL: https://github.com/apache/shardingsphere/issues/12513


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master branch
   
   ### Steps to reproduce the behavior
   When Start with cluster mode, and there is `no existed data on ZooKeeper,`  `NPE` will thrown from the method below:
   ```java
   @Subscribe
       public synchronized void renew(final PrimaryStateChangedEvent event) {
           ClusterSchema clusterSchema = event.getClusterSchema();
           Collection<ShardingSphereRule> rules = contextManager.getMetaDataContexts().getMetaDataMap().get(clusterSchema.getSchemaName()).getRuleMetaData().getRules();
           for (ShardingSphereRule each : rules) {
               if (each instanceof StatusContainedRule) {
                   ((StatusContainedRule) each).updateStatus(new PrimaryDataSourceChangedEvent(clusterSchema.getSchemaName(), clusterSchema.getDataSourceName(), event.getPrimaryDataSourceName()));
               }
           }
       }
   ```
   
   Error log:
   ```
   Exception thrown by subscriber method renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.event.PrimaryStateChangedEvent) on subscriber org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterContextManagerCoordinator@467045c4 when dispatching event: org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.event.PrimaryStateChangedEvent@7b691567
   java.lang.NullPointerException
   	at org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterContextManagerCoordinator.renew(ClusterContextManagerCoordinator.java:229)
   	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:87)
   	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:144)
   	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
   	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
   	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:67)
   	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:108)
   	at com.google.common.eventbus.EventBus.post(EventBus.java:212)
   	at java.util.Optional.ifPresent(Optional.java:159)
   	at org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcherFactory.lambda$watch$0(GovernanceWatcherFactory.java:55)
   	at org.apache.shardingsphere.mode.repository.cluster.zookeeper.CuratorZookeeperRepository.lambda$watch$1(CuratorZookeeperRepository.java:247)
   ```
   
   


-- 
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] RaigorJiang commented on issue #12513: [Mode] NPE occurred during Proxy startup.

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


   @menghaoranss 
   Proxy, mentioned in title.   😊


-- 
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] RaigorJiang commented on issue #12513: [Mode] NPE occurred during Proxy startup.

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


   ![image](https://user-images.githubusercontent.com/5668787/133717585-f37ed7c3-d0a7-4e76-b961-b21bbdaee84c.png)
   
   I only configured a shcema `sharding_db`, why the event got a clusterSchema named `logic_db.primary`?   And it must cause  the `get` result from metaDataMap is null.


-- 
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] menghaoranss commented on issue #12513: [Mode] NPE occurred during Proxy startup.

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


   @RaigorJiang  Proxy or JDBC?


-- 
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] menghaoranss commented on issue #12513: [Mode] NPE occurred during Proxy startup.

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


   @RaigorJiang reproduced, I will fix it asap, thanks for your feedback.


-- 
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] strongduanmu closed issue #12513: [Mode] NPE occurred during Proxy startup.

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


   


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