yhs0092 opened a new issue, #3624:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3624

   ## 测试版本
   
   2.8.2
   
   ## 问题原理分析
   
   问题出在 
`org.apache.servicecomb.registry.consumer.MicroserviceVersions#setInstances` 
方法中:
   ```java
         versions.forEach((key, value) -> value.setInstances(new 
ArrayList<>()));  // 步骤1, 将 MicroserviceVersion 内的实例列表置空
         for (Entry<String, List<MicroserviceInstance>> entry : 
mergedInstances.microserviceIdMap.entrySet()) {
           // always update microservice versions, because we allow 
microservice info override, like schema info
           MicroserviceVersion newVersion = 
createMicroserviceVersion(entry.getKey(), entry.getValue());
           newVersion.setInstances(entry.getValue());
           versions.put(entry.getKey(), newVersion);  // 步骤2, 用新 
MicroserviceVersion 替换旧的空 MicroserviceVersion
         }
   ```
   
   如上述代码片段, 步骤1和步骤2之间, 其他执行微服务调用逻辑的线程从 `MicroserviceVersions` 中拿到的 
`MicroserviceVersion` 是空的, 
这会影响`org.apache.servicecomb.core.registry.discovery.OperationInstancesDiscoveryFilter#sortedMicroserviceVersion`方法的逻辑,
 导致`OperationInstancesDiscoveryFilter`返回的可用实例列表为空, 业务微服务调用报错.


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

Reply via email to