https://github.com/spring-cloud/spring-cloud-openfeign/blob/647b0b3d1a61df4786c4d23dedf18e605184ef26/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/loadbalancer/RetryableFeignBlockingLoadBalancerClient.java#L142
When retry, retrievedServiceInstance is not assigned a value. So the retry feign client use the original url to send a request. But the original url not a callable address(service id, but instance ip), then the request will failed.
Comment From: qingdaoheze
I think the following codes should be added here.
} else {
retrievedServiceInstance = serviceInstance;
}
Comment From: OlgaMaciaszek
Thanks for reporting the issue, @qingdaoheze , do you mean this?
Comment From: qingdaoheze
No, I think it is a new bug. The service id in the subsequent request url is not replaced with the service instance ip and port
Comment From: OlgaMaciaszek
Thanks for the update @qingdaoheze . In this case, please provide a minimal, complete, verifiable example that reproduces the issue.
Comment From: qingdaoheze
Please refer to the simple project below: https://github.com/qingdaoheze/feign-rety-issue
Start the following two projects: feign-rety-issue/openfeign-client/src/main/java/org/example/openfeign/client/SayHelloClient.java feign-rety-issue/openfeign-server/src/main/java/org/example/openfeign/server/SayHelloServer.java
Then you can request to http://127.0.0.1:8001/say-hello. you will see the following error: java.net.UnknownHostException: hello-server
@OlgaMaciaszek
Comment From: OlgaMaciaszek
Hello, @qingdaoheze it does seem to have been that issue and it's already been fixed. After upgrading and removing an unnecessary dependency, I'm getting: feign.FeignException$InternalServerError: [500] during [GET] to [http://hello-server/sayHello?name=john] [SayHello#sayHello(String)]: [Hello john], which is the correct error.
Comment From: qingdaoheze
Yes, you are right. Thanks a lot!