Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6075

SimpleRateLimiter cast overflow results in Thread.sleep exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.10.3, 5.0, 6.0
    • Component/s: core/store
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      SimpleRateLimiter.pause() uses an uncheck cast of longs to ints:

      Thread.sleep((int) (pauseNS/1000000), (int) (pauseNS % 1000000));

      Although we check that pauseNS is positive, however if it's large enough the cast to int produces a negative value, causing Thread.sleep to throw an exception.

      We should protect for it.

        Attachments

        1. LUCENE-6075.patch
          3 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              bleskes Boaz Leskes
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: