PlaytikaOSS / feign-reactive

Reactive Feign client inspired by https://github.com/OpenFeign project
Apache License 2.0
615 stars 124 forks source link

With options reactive:client:config:default:retryOnSame and retryOnNext the response is not processed and the thread hangs consuming the CPU #594

Closed daromnik closed 11 months ago

daromnik commented 1 year ago

Hello.

I don't know if I need to create a separate issue or is it the same problem as here: https://github.com/PlaytikaOSS/feign-reactive/issues/590

But perhaps some information that I found will be useful.

After update Spring Boot 3 version (and reactor and netty libraries to last versions) requests are no longer normally sent through ReactiveFeignClient.

At first I thought it was the reactor library, so I created an issue there: https://github.com/reactor/reactor-netty/issues/2796 and some more information is in my issue on stackoverflow (there are screenshots on loading threads and consuming cpu): https://stackoverflow.com/questions/76163035/threads-reactor-http-nio-compute-something-for-a-long-time-and-consume-cpu-and-m. But in the end I found that the problems are due to retrays. And apparently the thread starts to hang and consume cpu precisely because of the infinite number of these retrays. I have params in applications:

reactive:
    client:
      config:
        default:
          options:
            connectTimeoutMillis: 30000
            readTimeoutMillis: 60000
          retryOnSame:
            builder: reactivefeign.retry.BasicReactiveRetryPolicy.Builder
            args:
              maxRetries: 1
              backoffInMs: 100
          retryOnNext:
            builder: reactivefeign.retry.BasicReactiveRetryPolicy.Builder
            args:
              maxRetries: 1
              backoffInMs: 100

If you remove these settings from the configuration, then everything works without problems. I also seem to have found out that the error occurs when there is a combination of these libraries in pom:

<dependency>
    <groupId>com.playtika.reactivefeign</groupId>
    <artifactId>feign-reactor-spring-configuration</artifactId>
</dependency>
<dependency>
    <groupId>com.playtika.reactivefeign</groupId>
    <artifactId>feign-reactor-spring-cloud-starter</artifactId>
    <type>pom</type>
</dependency>
<dependency>
    <groupId>com.playtika.reactivefeign</groupId>
    <artifactId>feign-reactor-webclient</artifactId>
</dependency>
kptfh commented 11 months ago

fixed