Hi,

I use openfeign (cloud version: 2022.0.0-RC2) to send the data to client application over REST API. When application starts, all the requests' processes to client application and responses were received successfully. But, after few hours' application failed to send any of the API request to client app and feign.RetryableException was thrown. Next consecutive retries too failing with same below error. I have to restart springboot application for API request to work again. May I know how this could be resolved?

feign.RetryableException: Timeout deadline: 180000 MILLISECONDS, actual: 180000 MILLISECONDS executing POST https://test.example.com/endpoints/test
        at feign.FeignException.errorExecuting(FeignException.java:277)
        at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:112)
        at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:72)
        at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:109)
        at jdk.proxy2/jdk.proxy2.$Proxy145.postMachineDetails(Unknown Source)

FeignClient code:

@FeignClient(name = "test")
public interface DxhClient {
    @RequestMapping(value = "/test",
            method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_VALUE)
    Response postMachineDetails(@RequestBody TestRequest testRequest);
}

application.yml configuration

spring:
  cloud:
    openfeign:
      cache:
        enabled: false
      client:
        config:
          test:
            url: https://test.example.com/endpoints
            connectTimeout: 30000
            readTimeout: 30000
            defaultRequestHeaders:
              Authorization: Bearer xxxxxxxxxx
              Connection: close
          default:
            connectTimeout: 30000
            readTimeout: 30000
      httpclient:
        hc5:
          enabled: true

Comment From: havjos

I have the same problem, but no clue, how to solve it.

Comment From: ghost

I solved it by changing client., what’s the http client that you use ?

Comment From: havjos

This I have in the stack trace Caused by: org.apache.hc.core5.http.ConnectionRequestTimeoutException: Timeout deadline: 180000 MILLISECONDS, actual: 180000 MILLISECONDS at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:119) ~[httpclient5-5.1.4.jar:5.1.4]

Reproducible, when I call repetitively the same call (app. 20x)

How did you solve please?

Comment From: ghost

I used two httpclients in the application.
Only for sending json payload in GET method call I used hc5 client (default configuration in application.yaml)

  cloud:
    openfeign:
      cache:
        enabled: false
      client:
        config:
          sample:
            url: ${ENDPOINT}
            connectTimeout: 30000
            readTimeout: 30000
            defaultRequestHeaders:
              Authorization: ${AUTH}
              Connection: close
          default:
            connectTimeout: 30000
            readTimeout: 30000
      httpclient:
        hc5:
          enabled: true

For other API calls, i used okhttp client. Configuration for feign client "sample" in application.yaml as like above.

SampleOkHttpConfig.class

public class SampleOkHttpConfig {
    @Bean
    public OkHttpClient client() {
        return new OkHttpClient();
    }
}

SampleClient.class

@FeignClient(name = "sample", configuration = SampleOkHttpConfig.class)
public interface SampleClient {
    @RequestMapping(value = "/test",
            method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_VALUE)
    Response postDetails(@RequestBody TestRequest testRequest);
}

Comment From: OlgaMaciaszek

Hello @ntpraveen1991 @havjos, please provide a minimal, complete, verifiable example that reproduces the issue, as a link to a GH repo with an executable app or tests and steps to reproduce. Please make sure you use supported versions. Spring Boot 2.7.18 or higher, Spring Cloud 2021.0.8 or higher.

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: yennor

I'm having the same problem with spring cloud 2024.0.0 and spring boot 3.4.1. Unfortunately the service consumed only allows connections from certain IPs and I can't influence that (Nor do I have access to the service to install it somewhere else), so I can't post a working example.

So I'm just posting that as general information that the problem seems to exist ;-)