-
Notifications
You must be signed in to change notification settings - Fork 715
Closed
Description
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:
- start consul, gateway in port 8080, a downstream service named demo-service, say on port 8082
- client sends request to service via gateway:
curl localhost:8080/demo-service/hello
#response: hello - 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