Skip to content

helidon-microprofile-fault-tolerance not retrying method annotated with @Asynchronous @Retry on specific exception #8974

Closed
@chaite

Description

After upgrading to helidon 4.x, helidon-microprofile-fault-tolerance won't retry the method annotated with @Asynchronous @Retry on specific exception

Environment Details

  • Helidon Version: 4.0.8
  • Helidon SE or Helidon MP: MP
  • JDK version: 21
  • OS: MacOS
  • Docker version (if applicable): Not Applicable

Problem Description

All the methods in sample below should be retried. However, only methods which have retryOn={Throwable.class} and retryOn={Exception.class} will be retried.

// this method will be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {Throwable.class})
public CompletableFuture<String> willBeRetriedOnThrowable() {
    logger.log(Level.INFO, "will be retried when retryOn={Throwable.class}");
    return CompletableFuture.failedFuture(new CustomRuntimeException());
}

// this method will be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {Exception.class})
public CompletableFuture<String> willBeRetriedOnException() {
    logger.log(Level.INFO, "will be retried when retryOn={Exception.class}");
    return CompletableFuture.failedFuture(new CustomRuntimeException());
}

// this method won't be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {RuntimeException.class})
public CompletableFuture<String> wontBeRetriedOnRuntimeException() {
    logger.log(Level.INFO, "won't be retried when retryOn={RuntimeException.class}");
    return CompletableFuture.failedFuture(new CustomRuntimeException());
}

// this method won't be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {CustomRuntimeException.class})
public CompletableFuture<String> wontBeRetriedOnActualException() {
    logger.log(Level.INFO, "won't be retried when retryOn={CustomRuntimeException.class}");
    return CompletableFuture.failedFuture(new CustomRuntimeException());
}

Steps to reproduce

  • Download attached maven project, unzip and open in IDE
  • Run org.example.Main.java
  • Application log will verify some methods are not retried

OR

  • Download attached maven project, unzip and build it with mvn clean package command
  • Then run application with java -jar <jar-location> command
  • Application log will verify some methods are not retried

Sample maven project showing the bug

fault-tolerance-bug.zip

Metadata

Assignees

Labels

4.xVersion 4.x

Type

No type

Projects

  • Status

    Closed

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions