You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case of a repeat with an exponential backoff the next delay will always be calculated based on the current iteration no matter which maximum value has been set.
After 63 iterations or less (depending on the initial value and factor) that will result in the following exception:
java.lang.ArithmeticException: Exceeds capacity of Duration: 9223372036854775808000000000
at java.time.Duration.create(Duration.java:1006) ~[?:1.8.0_162]
at java.time.Duration.multipliedBy(Duration.java:963) ~[?:1.8.0_162]
at reactor.retry.Backoff$3.apply(Backoff.java:94) ~[reactor-extra-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.retry.Backoff$3.apply(Backoff.java:91) ~[reactor-extra-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.retry.AbstractRetry.calculateBackoff(AbstractRetry.java:68) ~[reactor-extra-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.retry.DefaultRepeat.repeatBackoff(DefaultRepeat.java:113) ~[reactor-extra-3.1.6.RELEASE.jar:3.1.6.RELEASE]
at reactor.retry.DefaultRepeat.lambda$apply$1(DefaultRepeat.java:106) ~[reactor-extra-3.1.6.RELEASE.jar:3.1.6.RELEASE]
Once the current value is greater than max we should just set nextBackoff to maxBackoff and skip the computation.
The text was updated successfully, but these errors were encountered:
Thanks for the report @chringwer. Would you be willing to try a PR against the 3.1.x branch?
In reactor/reactor-core#1122 I introduced an operator directly in core that does exponential backoff. It is most probably suffering from the same issue so I'll need to investigate that.
This commit avoids backoff duration growing too large by:
1) not doing any computation if the current backoff is already equal to
configured maxBackoff
2) catching an `ArithmeticException` and setting the next backoff to
maxBackoff in that case
In case of a repeat with an exponential backoff the next delay will always be calculated based on the current iteration no matter which maximum value has been set.
reactor-addons/reactor-extra/src/main/java/reactor/retry/Backoff.java
Line 94 in a440eb7
After 63 iterations or less (depending on the initial value and factor) that will result in the following exception:
Once the current value is greater than max we should just set
nextBackoff
tomaxBackoff
and skip the computation.The text was updated successfully, but these errors were encountered: