最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin5浏览0评论

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

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.

Share Improve this question edited Feb 5 at 9:17 M. Deinum 125k22 gold badges230 silver badges246 bronze badges asked Feb 5 at 8:58 Subhash Subhash 112 bronze badges 5
  • Why are you manually managing the spring-cloud-starter-circuitbreaker-resilience4j version? That should be managed/come from the spring-cloud-dependencies to have a compatible version. Please include the config as text with code tags in your question instead of a link to an image. – M. Deinum Commented Feb 5 at 8:58
  • We are currently managing it that way, we can get it changed and let spring-cloud-dependencies manage it. The configuration as text I have updated. – Subhash Commented Feb 5 at 9:12
  • You shouldn't mix versions from different releases (as that is what you are doing). So start with that. It would also be interesting to see how you are testing this. – M. Deinum Commented Feb 5 at 9:17
  • We are letting spring-cloud-dependencies manage, still it doesn't resolve the issue. We already have some integration test which test the circuit breaker behavior, so when it crosses the failure-rate-threshold` of 90% (as per the configuration), the state of circuit breaker should be open & the service will return 503 unavailable. Now after the upgrade these tests fails, the service instead of returning 503 it returns 200. Is there any configuration changes that we need to adjust? – Subhash Commented Feb 5 at 11:22
  • You are pointing at Resilience4j, but what about your test. Please add it (as requested) to the question. – M. Deinum Commented Feb 5 at 12:34
Add a comment  | 

1 Answer 1

Reset to default 0

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.

发布评论

评论列表(0)

  1. 暂无评论