lpcy commented on issue #14129:
URL: https://github.com/apache/dubbo/issues/14129#issuecomment-2084575796

   > i can see the number of connections in DubboProtocol#getClients and it's 
normal.can u provide more information?i can't reproduce this bug.
   
   I found that DubboProtocol#getClients will be called twice:
   First:
   ```
   getClients:419, DubboProtocol (org.apache.dubbo.rpc.protocol.dubbo)
   protocolBindingRefer:412, DubboProtocol (org.apache.dubbo.rpc.protocol.dubbo)
   ......
   toInvokers:430, RegistryDirectory (org.apache.dubbo.registry.integration)
   refreshInvoker:292, RegistryDirectory (org.apache.dubbo.registry.integration)
   refreshOverrideAndInvoker:233, RegistryDirectory 
(org.apache.dubbo.registry.integration)
   notify:209, RegistryDirectory (org.apache.dubbo.registry.integration)
   notify:533, AbstractRegistry (org.apache.dubbo.registry.support)
   doNotify:373, FailbackRegistry (org.apache.dubbo.registry.support)
   notify:365, FailbackRegistry (org.apache.dubbo.registry.support)
   doSubscribe:241, ZookeeperRegistry (org.apache.dubbo.registry.zookeeper)
   subscribe:300, FailbackRegistry (org.apache.dubbo.registry.support)
   ......
   refreshInterfaceInvoker:464, MigrationInvoker 
(org.apache.dubbo.registry.client.migration)
   migrateToApplicationFirstInvoker:245, MigrationInvoker 
(org.apache.dubbo.registry.client.migration)
   refreshInvoker:76, MigrationRuleHandler 
(org.apache.dubbo.registry.client.migration)
   doMigrate:60, MigrationRuleHandler 
(org.apache.dubbo.registry.client.migration)
   ......
   createInvoker:615, ReferenceConfig (org.apache.dubbo.config)
   createProxy:461, ReferenceConfig (org.apache.dubbo.config)
   init:348, ReferenceConfig (org.apache.dubbo.config)
   ......
   ```
   second:
   ```
   getClients:419, DubboProtocol (org.apache.dubbo.rpc.protocol.dubbo)
   protocolBindingRefer:412, DubboProtocol (org.apache.dubbo.rpc.protocol.dubbo)
   ......
   toInvokers:419, ServiceDiscoveryRegistryDirectory 
(org.apache.dubbo.registry.client)
   refreshInvoker:313, ServiceDiscoveryRegistryDirectory 
(org.apache.dubbo.registry.client)
   refreshOverrideAndInvoker:197, ServiceDiscoveryRegistryDirectory 
(org.apache.dubbo.registry.client)
   notify:189, ServiceDiscoveryRegistryDirectory 
(org.apache.dubbo.registry.client)
   addListenerAndNotify:236, ServiceInstancesChangedListener 
(org.apache.dubbo.registry.client.event.listener)
   subscribeURLs:330, ServiceDiscoveryRegistry 
(org.apache.dubbo.registry.client)
   doSubscribe:227, ServiceDiscoveryRegistry (org.apache.dubbo.registry.client)
   subscribe:189, ServiceDiscoveryRegistry (org.apache.dubbo.registry.client)
   subscribe:88, ListenerRegistryWrapper (org.apache.dubbo.registry)
   subscribe:184, DynamicDirectory (org.apache.dubbo.registry.integration)
   subscribe:140, ServiceDiscoveryRegistryDirectory 
(org.apache.dubbo.registry.client)
   doCreateInvoker:629, RegistryProtocol (org.apache.dubbo.registry.integration)
   getServiceDiscoveryInvoker:65, InterfaceCompatibleRegistryProtocol 
(org.apache.dubbo.registry.integration)
   refreshServiceDiscoveryInvoker:440, MigrationInvoker 
(org.apache.dubbo.registry.client.migration)
   migrateToApplicationFirstInvoker:246, MigrationInvoker 
(org.apache.dubbo.registry.client.migration)
   refreshInvoker:76, MigrationRuleHandler 
(org.apache.dubbo.registry.client.migration)
   doMigrate:60, MigrationRuleHandler 
(org.apache.dubbo.registry.client.migration)
   onRefer:249, MigrationRuleListener 
(org.apache.dubbo.registry.client.migration)
   interceptInvoker:594, RegistryProtocol 
(org.apache.dubbo.registry.integration)
   ......
   createInvoker:615, ReferenceConfig (org.apache.dubbo.config)
   createProxy:461, ReferenceConfig (org.apache.dubbo.config)
   init:348, ReferenceConfig (org.apache.dubbo.config)
   ```
   The key method is MigrationInvoker#migrateToApplicationFirstInvoker. The 
getClients method will be called separately once:
   ```java
       @Override
       public void migrateToApplicationFirstInvoker(MigrationRule newRule) {
           CountDownLatch latch = new CountDownLatch(0);
           refreshInterfaceInvoker(latch);
           refreshServiceDiscoveryInvoker(latch);
   
           // directly calculate preferred invoker, will not wait until address 
notify
           // calculation will re-occurred when address notify later
           calcPreferredInvoker(newRule);
       }
   ```


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to