Spring Cloud service Look up error: Load balancer does not have available server for client

14,040

Upon further investigation, I found that if eureka.client.fetchRegistry is false, the various shuffle methods in com.netflix.discovery.shared.Applications are not called and hence Applications.shuffleVirtualHostNameMap is never populated. This map is used later for look up in the method Applications.getInstancesByVirtualHostName that then fails.

I don't understand why a client would be forced to download the registry. They may choose to make the network trip each time or get delta when necessary.

I've opened an issue on Github for this. Will wait for their response.

Share:
14,040
Abhijit Sarkar
Author by

Abhijit Sarkar

Mostly. nice. guy

Updated on June 04, 2022

Comments

  • Abhijit Sarkar
    Abhijit Sarkar almost 2 years

    I've been playing with a Spring Cloud app consisting of a config server, a discovery server (Eureka) and a Feign client with Ribbon (internally used by Feign). I've 2 services, a movie-service and a daily-update-service. The intent is to provide a daily update of popular movies, news and weather in one place. Problem I'm having is that the movie-service Feign client is not able to find it from daily-update-service. It errors out with the following:

    Caused by: java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service
    daily_update_service_1 |    at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:59) ~[spring-cloud-netflix-core-1.1.0.M4.jar:1.1.0.M4]
    daily_update_service_1 |    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:95) ~[feign-core-8.12.1.jar:8.12.1]
    daily_update_service_1 |    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:74) ~[feign-core-8.12.1.jar:8.12.1]
    daily_update_service_1 |    at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:54) ~[feign-hystrix-8.12.1.jar:8.12.1]
    daily_update_service_1 |    at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294) ~[hystrix-core-1.4.21.jar:1.4.21]
    daily_update_service_1 |    ... 21 common frames omitted
    daily_update_service_1 | Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service
    daily_update_service_1 |    at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:468) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0]
    daily_update_service_1 |    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0]
    daily_update_service_1 |    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0]
    

    My debugging so far shows that the DomainExtractingServerList is trying to do a look up by VIP, which's movie-service and coming up with no servers. The services are registered in Eureka and I can see them on the Eureka dashboard.

    I'm not sure what pieces of the code are relevant so I'm posting a link to the Github project. Assuming you've Docker and Docker Compose installed, the easiest way to get it up and running is to clone the project and then follow the following instructions. These instructions are for a Mac/Linux OS, adapt them if necessary to Windows. I'll provide specific code snippets if someone wants to see it here instead of looking in the code.

    1. cd daily-update-microservices.
    2. Replace all occurences of my docker host IP with yours. You can use this command: grep -rl '192.168.99.107' . | xargs perl -pi -e "s/192\.168\.99\.107/$(echo $DOCKER_HOST | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')/"
    3. Run ./gradlew clean buildDockerImage
    4. Run docker-compose -f daily-update-service/docker-compose.yml up.
    5. Once the services come up, do a curl -v http://$(echo $DOCKER_HOST | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'):10000/dailyupdate/movies/popular
  • Max G
    Max G almost 8 years
    The issue has been closed. Quote from user 'spencergibb' on your issue on Github: > fetching the registry is how eureka is able to tell ribbon (loadbalancer) about > what servers are available.
  • Laxman
    Laxman about 7 years
    I followed the link on issue on Github. I was missing Eureka dependency in pom