0

My project state:

  • Java 17
  • Spring Boot 3.2.0
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
    <version>3.1.0</version>
</dependency>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
    <exclusions>
        <exclusion>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-hystrix</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Client:

@FeignClient(
    name = "serviceB",
    url = "url"
    configuration = [ServiceBClientFeignConfig::class]
)
interface PredictionBannerClient {

    @Timed("prediction-banner", histogram = true, percentiles = [0.5, 0.8, 0.85, 0.90, 0.95, 0.99])
    @CircuitBreaker(name = "serviceB-banner")
    @PostMapping("/endpoint")
    fun callApi(
        @RequestBody request: ProtoRequest,
    ): List<ProtoResponse>
    }

class ServiceBClientFeignConfig(
    @Value("\${readTimeout}")
    val readTimeout: Long,
    @Value("\${connectTimeout}")
    val connectTimeout: Long
) {

    @Bean
    fun feignOptions(): Request.Options {
        return Request.Options(Duration.ofMillis(readTimeout), Duration.ofMillis(connectTimeout), true)
    }
}

In Service A calling service B with FeignClient and circuitbreaker config like below:

resilience4j:
  circuitbreaker:
    metrics:
      enabled: true
      legacy:
        enabled: true
    configs:
      default:
        sliding-window-type: count_based
        sliding-window-size: 60
        automatic-transition-from-open-to-half-open-enabled: true
      disable-config:
        minimum-number-of-calls: 1000_000_000
        sliding-window-type: time_based
        sliding-window-size: 60
    instances:
      serviceB-video:
        base-config: default
        minimumNumberOfCalls: 100
        failureRateThreshold: 35
        waitDurationInOpenState: 60s
        slowCallDurationThreshold: 250ms
        slowCallRateThreshold: 35
        permittedNumberOfCallsInHalfOpenState: 100
        eventConsumerBufferSize: 10
      serviceB-banner:
        base-config: default
        minimumNumberOfCalls: 1000
        failureRateThreshold: 35
        waitDurationInOpenState: 60s
        slowCallDurationThreshold: 140ms
        slowCallRateThreshold: 35
        permittedNumberOfCallsInHalfOpenState: 100
        eventConsumerBufferSize: 10

In my system everything is fine, when deploy it on kuber at first circuitBreaker opened and I get callNotPermitted exception and after a while getting below error:

ERROR| o.a.c.c.C.[.[.[.[dispatcherServlet] | Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed: java.lang.StackOverflowError] with root cause
java.lang.StackOverflowError: null
    at java.base/java.time.Clock.currentInstant(Clock.java:498)
    at java.base/java.time.Clock$SystemClock.instant(Clock.java:614)
    at io.github.resilience4j.circuitbreaker.internal.CircuitBreakerStateMachine$OpenState.tryAcquirePermission(CircuitBreakerStateMachine.java:733)
    at io.github.resilience4j.circuitbreaker.internal.CircuitBreakerStateMachine$OpenState.tryAcquirePermission(CircuitBreakerStateMachine.java:737)

At first my Java version is 21, after reading doc, change Java version to 17.

5
  • Note that Spring 3.2.0 (which your title referred to initially) is ancient, and years older than Spring Boot 3.2.0 (the Spring versions are not related to the Spring Boot versions!) Commented Dec 19, 2023 at 11:08
  • I believe there might be a misunderstanding. I used Spring Boot 3.2.0 which was released a few months ago. Commented Dec 23, 2023 at 11:16
  • No, there is no misunderstanding, but the initial revision said (in the title) you used Spring 3.2.0, which is not the same as Spring Boot 3.2.0. I fixed that by editing your post to prevent others from having that misunderstanding, but I pointed it out in the comments so you don't make the same mistake in the future. Mistakes like that can also cause people to ignore your question because they don't want to dive into problems with old versions. Commented Dec 23, 2023 at 11:18
  • @ali were you able to get this resolved?? Commented Feb 20, 2024 at 23:03
  • @MadhuReddy I apologize for the delay in replying. No, the problem has not been solved and I did not have time to find a solution for it Commented Jul 2, 2024 at 19:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.