Skip to content

reactor loadbalancer unable to locate service node after it's restarted #842

@paulluap

Description

@paulluap

Describe the bug

The reactor loadbalancer with health check (HealthCheckServiceInstanceListSupplier) cannot locate a service node after the node is restarted on a different port.

The following gateway properties are set:

#turn on the recommended ReactiveLoadBalancerClientFilter instead of ribbon
spring.cloud.loadbalancer.ribbon.enabled=false
# turns on withHealthChecks().withCaching
spring.cloud.loadbalancer.configurations=health-check

spring.application.name=demo-gateway
spring.cloud.gateway.discovery.locator.enabled=true

Steps to reproduce:

  1. start consul, gateway in port 8080, a downstream service named demo-service, say on port 8082
  2. client sends request to service via gateway:
    curl localhost:8080/demo-service/hello
    #response: hello
  3. restart the service on port 8083, repeat 2, then the gateway always returns 503.

When debuging, it is found in the method:
org.springframework.cloud.loadbalancer.core.HealthCheckServiceInstanceListSupplier.healthCheckFlux(List<ServiceInstance>)
It always checks an obselete service instance (the one with port 8082), which is never alive after the restart.

spring boot and cloud version: 2.2.11.RELEASE, Hoxton.SR8

Sample

Minimun example to reproduce:
https://github.com/paulluap/reproduce-lb-failure

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions