Subhash
Subhash

Reputation: 11

The resilience4j circuitbreaker does not seems to work expected after the Spring Boot & Cloud dependencies upgrade

We are seeing an issue with resilience4j circuit breaker after a recent upgrade of Spring Boot & Cloud dependencies.

We upgraded the following below:

groupId artifactId old version upgraded version
org.springframework.boot spring-boot 3.3.7 3.4.1
org.springframework.cloud spring-cloud-dependencies 2023.0.1 2024.0.0

The Circuitbreaker Resilience4j version what we use in our application is 3.1.3 version.

groupId artifactId version used
org.springframework.cloud spring-cloud-starter-circuitbreaker-resilience4j 3.1.3

After the Spring Boot & Cloud dependencies upgrade, we see the test cases related to the Circuitbreaker are breaking because the the Circuitbreaker is not behaving expected after the upgrade. The configuration related to Circuitbreaker Resilience4j are unchanged.

Our configuration (values which would be used to execute the integration test)

resilience4j:
  circuitbreaker:
    configs:
      shared:
        sliding-window-type: count_based
        sliding-window-size: 10
        minimum-number-of-calls: 10
        failure-rate-threshold: 90
        slow-call-rate-threshold: 90
        slow-call-duration-threshold: 50ms
        wait-duration-in-open-state: 1s
        permitted-number-of-calls-in-half-open-state: 5
        max-wait-duration-in-half-open-state: 0s
        writable-stack-trace-enabled: true
        automatic-transition-from-open-to-half-open-enabled: true
        register-health-indicator: true
    instances:
      XXXXXService:
        base-config: shared

Before the upgrade, the resilience4j version 2.1.0 was getting bundled. Now after the upgrade, it is the resilience4j version 2.2.0 . Is there any known issue OR Is there any configuration change that we need to adjust ? It would be really helpful if someone can throw some light into this. Thanks in advance!

We tried to upgrade the spring-cloud-starter-circuitbreaker-resilience4j to 3.2.0, which didn't help. Tried looking for compatibility matrix information which we couldn't find anywhere. Enabled debug logs org.springframework.cloud.circuitbreaker.resilience4j: debug which also didn't give much clue. The configuration related to Circuitbreaker Resilience4j we tweaked based on trial and error basis, since it didn't help, kept the configuration unchanged.

Upvotes: 1

Views: 85

Answers (1)

Sablier
Sablier

Reputation: 81

I got this issue on our migration to spring boot 3.4.2 too.

I tried spring-cloud-starter-circuitbreaker-resilience4j, with no chance, so I reverted back to io.github.resilience4j:resilience4j-spring-boot3.

I discovered that a dependency was missing (I got the hint from https://stackoverflow.com/a/61930362):

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-aop</artifactId>
    <version>${spring-boot.version}</version>
</dependency>

spring-boot-starter-aop was dropped in spring-cloud-openfeign-core:4.1.2.

If you are using spring-cloud-openfeign, it is probably the problem.

Here is the commit who removed this dependency: https://github.com/spring-cloud/spring-cloud-openfeign/commit/6084609de0705f24ba418704769e545a0d820d70

I don't know why it was removed and what is needed from there, but adding it back makes my circuitbreaker work again.

PS: I think I can manage to make it work with spring-cloud-starter-circuitbreaker-resilience4j, but it has too much impact on our code, like wrapping FeignException into a NoFallbackAvailableException.

Upvotes: 0

Related Questions