[
https://issues.apache.org/jira/browse/CURATOR-262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15168166#comment-15168166
]
ASF GitHub Bot commented on CURATOR-262:
----------------------------------------
GitHub user ddyankov opened a pull request:
https://github.com/apache/curator/pull/136
CURATOR-262: Fixed integer overflow issue with sleepMs
https://issues.apache.org/jira/browse/CURATOR-262
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ddyankov/curator CURATOR-262
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/curator/pull/136.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #136
----
commit 630c009a410eff13c4428704700d566abe417bda
Author: Dimitar Dyankov <[email protected]>
Date: 2016-02-26T00:23:38Z
CURATOR-262: Fixed integer overflow issue with sleepMs
----
> Issue with ExponentialBackoffRetry
> ----------------------------------
>
> Key: CURATOR-262
> URL: https://issues.apache.org/jira/browse/CURATOR-262
> Project: Apache Curator
> Issue Type: Bug
> Reporter: Dimitar Dyankov
> Assignee: Jordan Zimmerman
> Labels: newbie
>
> Hi,
> Looking at the ExponentialBackOff Strategy for the apache curator I found
> this issue :
> @Override
> protected int getSleepTimeMs(int retryCount, long elapsedTimeMs)
> {
> // copied from Hadoop's RetryPolicies.java
> int sleepMs = baseSleepTimeMs * Math.max(1, random.nextInt(1 <<
> (retryCount + 1)));
> if ( sleepMs > maxSleepMs )
> {
> log.warn(String.format("Sleep extension too large (%d). Pinning
> to %d", sleepMs, maxSleepMs));
> sleepMs = maxSleepMs;
> }
> return sleepMs;
> }
> since sleepMs is an Integer and retryCount could be as large as 29 we could
> fall into an integer overflow case and therefore sleepMs being a negative
> number.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)