NullPointerException in MicrometerStatsLoadBalancerLifecycle · Issue #1453 · spring-cloud/spring-cloud-commons · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We came across this issue while investigating load balancer statistics with Spring Cloud Gateway. Our build pulls in Spring Cloud Loadbalancer 4.1.5:
java.lang.NullPointerException: Cannot invoke "org.springframework.cloud.client.loadbalancer.Response.getServer()" because the return value of "org.springframework.cloud.client.loadbalancer.CompletionContext.getLoadBalancerResponse()" is null
at org.springframework.cloud.loadbalancer.stats.MicrometerStatsLoadBalancerLifecycle.onComplete(MicrometerStatsLoadBalancerLifecycle.java:96) ~[spring-cloud-loadbalancer-4.1.5.jar:4.1.5]
Suppressed: org.springframework.cloud.gateway.support.NotFoundException: 503 SERVICE_UNAVAILABLE "Unable to find instance for hc-gatewaywithactivehealthchecktest-0-gatewaywithactivehealthchecktest-map-0"
at org.springframework.cloud.gateway.support.NotFoundException.create(NotFoundException.java:45) ~[spring-cloud-gateway-server-4.1.6.jar:4.1.6]
at org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter.lambda$filter$2(ReactiveLoadBalancerClientFilter.java:123) ~[spring-cloud-gateway-server-4.1.6.jar:4.1.6]
We found the problem when we enabled loadbalancer Micrometer statistics on our gateway instance, which had a test route configured with loadbalancing and a health check. The service that this route resolved to was backed by two k8s pods, both of which were returning a health status of DOWN. So prior to enabling statistics we were receiving the expected 503 response from our test route, since no service instances were available. When we enabled statistics, we began to receive a 500 error instead due to the uncaught NullPointerException.
The text was updated successfully, but these errors were encountered:
Thanks @spikymonkey. Fixed for null-handling. Once you have a sample, feel free to create a separate issue to verify if there's a spot where null response should be swapped for EmptyResponse.
We came across this issue while investigating load balancer statistics with Spring Cloud Gateway. Our build pulls in Spring Cloud Loadbalancer 4.1.5:
We found the problem when we enabled loadbalancer Micrometer statistics on our gateway instance, which had a test route configured with loadbalancing and a health check. The service that this route resolved to was backed by two k8s pods, both of which were returning a health status of
DOWN
. So prior to enabling statistics we were receiving the expected 503 response from our test route, since no service instances were available. When we enabled statistics, we began to receive a 500 error instead due to the uncaughtNullPointerException
.The text was updated successfully, but these errors were encountered: