This topic describes the solution to the issue that an unexpected service provider is called by the application service.

Problem description

  • When a service provider is called by the application service, an error message appears and indicates that no service provider is available or no service is found.
  • After a service provider is restarted or released, the IP address of the service provider changes. However, the original IP address of the service provider is still called by the application service.

Cause

  • The service provider is not registered with a Microservices Engine (MSE) instance or is registered with an invalid environment.
  • An exception occurs on the network or the service consumer. As a result, the Nacos client cannot obtain the latest IP address of the service provider.
  • The Nacos client has obtained the latest IP address of the service provider, but the latest IP address of the service provider is not used because routing rules or weight rules are configured or the framework cache is used.

Solution

  1. In the MSE console, check whether the service provider is displayed and whether the number of nodes in the service provider and the IP address of the service provider are as expected. For more information, see View service details.

    If the expected service provider is not displayed in the MSE console, follow the instructions in What do I do if the registration of a service provider fails? to resolve the issue.

  2. If the original IP address of the service provider is still displayed in the MSE console, follow the instructions in What do I do if the IP address of an unavailable service provider can still be viewed in the MSE console? to resolve the issue.
  3. If the service provider is displayed in the MSE console and the displayed IP address of the service provider is the expected IP address, perform the following operations to check whether the displayed IP address is successfully pushed.
    1. If the MSE Nacos instance is in a version of the Professional Edition and the version of the Nacos client in use is 2.0.0 or later, search for the IP address push tracks of the service provider or service consumer and check whether the related push records exist. If the related push records exist, the push is successful. For more information about push tracks, see Push tracking.
    2. If the MSE Nacos instance is in version 2.0.4.0 or later of the Professional Edition and the version of the Nacos client in use is 2.0.0 or later, check whether the value of Service push success rate on the Push monitoring tab is 100%. For more information about how to view metric data, see Use the Grafana dashboard.
    3. If the MSE Nacos instance is in a version of the Basic Edition or a Nacos client in an earlier version is used, obtain the logs of the Nacos client from the service consumer, search for information based on the keyword current ips and the service name, and then check whether the number of nodes and details of the service provider in the logs are consistent with those displayed in the MSE console. If they are consistent, the Nacos client receives the latest IP address that is pushed. For more information about how to obtain the logs of a Nacos client, see How do I obtain logs from a Nacos client?.
  4. If you confirm that the service provider list is successfully pushed after you perform the preceding steps, the latest IP address is not used by the service provider. Identify the cause of the issue based on the framework used by the service provider or the logic of the service provider. In most cases, this issue occurs in the following scenarios:
    1. If the Spring Cloud framework uses an auxiliary plug-in framework such as Feign, LoadBalancer, or Robin, the latest IP address of the service provider in the Nacos client is never used or is not used at the earliest opportunity due to the caching or routing rules. Troubleshoot the issue based on the framework in use.
    2. The multi-subscription issue exists in Dubbo 2.7.7 to 2.7.16. In this scenario, the latest IP address that is pushed may not be used. Upgrade the Dubbo version to 2.7.17 or later or enable empty list protection. For more information about how to enable empty list protection, see Empty list protection.
  5. If you do not confirm that the service provider list is successfully pushed after you perform the preceding steps, view the cause of the push failure in the logs of the Nacos client.
    1. If a timeout-related error message such as read time out or connected timeout is displayed, follow the instructions in What do I do if the connection between an application and an MSE Nacos instance times out? to resolve the issue.
    2. If the Nacos client in a version of 2.0.0 to 2.0.4 is used and the org.reflections toolkit is used by the service provider, the issue may be caused by a toolkit conflict. To resolve the issue, use the org.reflections toolkit in version 0.9.11 or upgrade the version of the Nacos client to 2.1.0 or later.