Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-262

Issue with ExponentialBackoffRetry

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.11.0, 3.2.0
    • None

    Description

      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.

      Attachments

        Activity

          People

            cammckenzie Cam McKenzie
            ddyankov Dimitar Dyankov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: