resilience4j
resilience4j copied to clipboard
Cannot set exponential backoff to false in one instance if set to true for default config.
Resilience4j version: 2.2.0
Java version: 17
Springboot version: 3.2.1
Hello all, So I encountered an error when setting the retry config in my application.properties file which is causing an error when I run my Springboot application. If I have enable-exponential-backoff set to true in the default config as I need it for most of my instances, but set it to false for only one instance, I am getting the error seen below where the intervalFunction param is set twice. This error is also occurring if I do not modify the default config at all and manually change the settings for each retry instance individually (see second .properties snippet). After a lot of debugging and searching, I believe this is a bug with the library and from what I've seen, there is both an intervalBiFunction and an intervalFunction set at the same time.
Thank you in advance.
First properties file:
resilience4j.retry.configs.default.max-attempts=5
resilience4j.retry.configs.default.ignore-exceptions=org.springframework.web.client.HttpClientErrorException
resilience4j.retry.configs.default.wait-duration=5000
resilience4j.retry.configs.default.enable-exponential-backoff=true
resilience4j.retry.configs.default.exponential-backoff-multiplier=2
resilience4j.retry.instances.instance-A.max-attempts=3
resilience4j.retry.instances.instance-A.wait-duration=5000
resilience4j.retry.instances.instance-A.enable-exponential-backoff=false
Second properties file:
resilience4j.retry.instances.instance-A.enable-exponential-backoff=true
resilience4j.retry.instances.instance-A.exponential-backoff-multiplier=2
resilience4j.retry.instances.instance-A.max-attempts=5
resilience4j.retry.instances.instance-A.wait-duration=5000
resilience4j.retry.instances.instance-B.enable-exponential-backoff=false
resilience4j.retry.instances.instance-B.exponential-backoff-multiplier=2
resilience4j.retry.instances.instance-B.max-attempts=5
resilience4j.retry.instances.instance-B.wait-duration=5000
Error:
java.lang.IllegalStateException: The intervalFunction was configured twice which could result in an undesired state. Please use either intervalFunction or intervalBiFunction.
Reproduced within my test project. This issue effects from version 2.0.0 to 2.2.0, version 1.7.1 is OK.
| R4j version | Java version | SpringBoot version | dependency | effected by this issue |
|---|---|---|---|---|
| 2.2.0 | 17 | 3.3.2 | io.github.resilience4j:resilience4j-spring-boot3 | Yes |
| 2.1.0 | 17 | 3.3.2 | io.github.resilience4j:resilience4j-spring-boot3 | Yes |
| 2.0.2 | 17 | 3.3.2 | io.github.resilience4j:resilience4j-spring-boot3 | Yes |
| 2.0.1 | 17 | 3.3.2 | io.github.resilience4j:resilience4j-spring-boot3 | Yes |
| 2.0.0 | 17 | 2.7.18 | io.github.resilience4j:resilience4j-spring-boot2 | Yes |
| 1.7.1 | 17 | 2.7.18 | io.github.resilience4j:resilience4j-spring-boot2 | No |
It seems that the intervalFunction and intervalBiFunction fields in io.github.resilience4j.retry.RetryConfig.Builder should never be both non-null at any time. Am I right? @RobWin
Yes, correct
I have implemented the fix locally, but now I can't run the test without modifying the build.gradle file.
Locally, I removed the org.asciidoctor.convert plugin and the asciidoctorj block. After that the test can be executed.
I've notice PR #2191 .I believe that's the problem I'm having right now. I will wait for that PR to merge before submitting my fix.