Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-4532

race-condition in commit-rate-limiter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.4
    • 1.5.6, 1.6.0
    • core
    • None

    Description

      CommitRateLimiter.delay has a race-condition when the queue length drops below thres-hold right when delay() is called. Consider the following steps:

      • thread T1 enters delay() with a positive value for delay but gets paused right after the check for delay>0
      • thread T2 enters setDelay(0), thus goes into the synchronized block and does a notifyAll
      • thread T1 continues in delay() after above mentioned check, thus now goes into the synchronized block - at this stage delay is 0 (as it's volatile) - thus it sets dt=0.
      • thread T1 then goes and calls wait(0) - which is an infinite wait, until it gets notified. This can be forever if the threshold is never ever hit again.

      Would suggest to do a while loop rather than a do-while

      Attachments

        Activity

          People

            stefanegli Stefan Egli
            stefanegli Stefan Egli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: