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
finagle-core: ExponentialJitteredBackoff random zero bugfix
**Problem:** `ExponentialJitteredBackoff.next` throws an exception occasionally.
``` java.lang.IllegalArgumentException:
at java.base/java.util.concurrent.ThreadLocalRandom.nextLong(ThreadLocalRandom.java:361)
at com.twitter.finagle.util.Rng$$anon$2.nextLong(Rng.scala:71) ERR
at com.twitter.finagle.Backoff$ExponentialJittered.next(Backoff.scala:331) ```
**Bug:** `Rng.nextLong(n)` generates a number from 0 (inclusive) to n
(exclusive). When it generates 0 as random number. The next occurrence of
backoff.next would try fetching `Rng.nextLong(0)` which is illegal argument.
**Fix:** Add 1 to the generated random, so that `Rng.nextLong(_)` can accept the
number. Since the random generated is exclusive on the `n` provided, this
doesn't cause overflow as well.
JIRA Issues: STOR-8734
Differential Revision: https://phabricator.twitter.biz/D1178528
0 commit comments