Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15928

TimeoutException does not trigger Resilience4j circuit breaker

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.4
    • 3.7.1, 3.4.6, 3.8.0
    • came-core, eip
    • None
    • Unknown

    Description

      Currently Timeout exceptions does not trigger circuit breaker. But they should. I don't want to continue spam my server, if it slightly started dying.

      I tried to hot-fix in the next way - hot_fix.diff

      The idea behind patch is next. Currently we wrap our call with circuit breaker and only after that with time limiter. So, circuit breaker doesn't know anything about time-outs. 

      And basically I do opposite - initially wrap call with time limiter and only after that, wrap it with circuit breaker. So circuit breaker will aware about time-out exception and can react properly.

      The issue which I have afterward, that, for cases when circuit breaker was open, I started receiving blank 200 OK response.

      I tried to fix it by removing recover(fallbackTask) part at all:

       

      // Try.ofCallable(task).recover(fallbackTask).andFinally(() -> callback.done(false)).get(); //old code
      Try.ofCallable(task).andFinally(() -> callback.done(false)).get(); // new line of code
      

      And seems like it works fine. But tests are failing, and I'm not sure how exactly it should be fixed. 

      Also another fix, which seems like works fine and tests are not failing:

      CircuitBreakerFallbackTask

       

      } else if (throwable instanceof CallNotPermittedException) {
          // the circuit breaker triggered a call rejected
          exchange.setProperty(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, false);
          exchange.setProperty(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, false);
          exchange.setProperty(CircuitBreakerConstants.RESPONSE_SHORT_CIRCUITED, true);
          exchange.setProperty(CircuitBreakerConstants.RESPONSE_REJECTED, true);
          throw RuntimeExchangeException.wrapRuntimeException(throwable); // new line of code
          //return exchange; // old code
      

       

       

      Please, assist.

      Attachments

        1. camel_fix_for_fallback.diff
          8 kB
          Alex Liroyd
        2. failed_tests_with_time_out.patch
          11 kB
          Alex Liroyd
        3. hot_fix.diff
          2 kB
          Alex Liroyd
        4. image-2020-12-21-13-10-40-893.png
          32 kB
          Alex Liroyd
        5. test_errors_stackTrace.txt
          24 kB
          Alex Liroyd

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            Liroyd Alex Liroyd
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment