Uploaded image for project: 'WildFly WIP'
  1. WildFly WIP
  2. WFWIP-307

MP Fault Tolerance - unexpected behaviour @Fallback method calls with @CircuitBreaker

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • MP Fault Tolerance
    • None
    • Hide

      Steps to reproduce:

      • Build WF from PR - https://github.com/wildfly/wildfly/pull/13022
      • Run the test:
        git clone git@github.com:jboss-eap-qe/eap-microprofile-test-suite.git
        cd eap-microprofile-test-suite
        mvn clean verify -Djboss.dist=<path-to-built-wildfly>/wildfly-19.0.0.Beta3-SNAPSHOT -DfailIfNoTests=false -Dtest=FaultTolerance20AsyncPartialTest#retryCircuitBreaker
        
      Show
      Steps to reproduce: Build WF from PR - https://github.com/wildfly/wildfly/pull/13022 Run the test: git clone git@github.com:jboss-eap-qe/eap-microprofile-test-suite.git cd eap-microprofile-test-suite mvn clean verify -Djboss.dist=<path-to-built-wildfly>/wildfly-19.0.0.Beta3-SNAPSHOT -DfailIfNoTests= false -Dtest=FaultTolerance20AsyncPartialTest#retryCircuitBreaker

      MP FT does not behave correctly in case when there is @CircuitBreaker, @Fallback, @Retry and @Asynchronous on service method. @CircuitBreaker does not get opened based on its configuration and @Fallback method is called with incorrect value.

      Test scenario:

      • Deploy MP FT service with:
        @Asynchronous
        @Retry(retryOn = IOException.class)
            @CircuitBreaker(failOn = IOException.class, requestVolumeThreshold = 5, successThreshold = 3, delay = 2, delayUnit = ChronoUnit.SECONDS, failureRatio = 0.75)
            @Fallback(fallbackMethod = "processFallback")
            public CompletionStage<MyConnection> retryCircuitBreaker(int counter) throws IOException {
                System.out.println("retryCircuitBreaker - called - " + counter);
                if (counter % 4 != 0) { // 3/4 requests trigger IOException
                    System.out.println("retryCircuitBreaker - called - " + counter + " throwing exception");
                    throw new IOException("Simulated IOException");
                }
                System.out.println("retryCircuitBreaker - called - " + counter + " success");
                return CompletableFuture.completedFuture(new MyConnection() {
                    @Override
                    public String getData() {
                        return "Hello from @Retry @CircuitBreaker method" + counter;
                    }
                });
            }
        
            private CompletionStage<MyConnection> processFallback(int counter) {
                System.out.println("processFallback - returned url counter: " + counter);
                return CompletableFuture.completedFuture(new MyConnection() {
                    @Override
                    public String getData() {
                        return "Fallback Hello" + counter;
                    }
                });
            }
        
      • Sends 16 parallel requests. Every 4th requests pass (including 0th one as there is modulo 4), and 12 invocations fail on IOException.
      • Try on more request and check that @Fallback method was called as circuit is open

      Expected result:
      Circuit gets opened and @Fallback method is called.

      Actual Result:
      Circuit is not opened and @Fallback method is called.

              rhn-engineering-rhusar Radoslav Husar
              mnovak1@redhat.com Miroslav Novak
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: