Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-5524

Race condition in SemaphoreCompletionService.executeFront()

    XMLWordPrintable

Details

    Description

      If two threads call executeFront() at the same time, it's possible that none of them executes any task, although there are permits available, and one of the threads just added a task in the queue. This scenario causes random initial state transfer timeouts in the testsuite:

      1. T1: continueTaskInBackground(): queue = empty, permits = 0
      2. T1: backgroundTaskFinished()
      3. T1: = semaphore.release(): queue = empty, permits = 1
      4. T1: = executeFront()
      5. T1: == semaphore.acquire() -> true: queue = empty, permits = 0
      6. T2: == queue.poll() -> null
      7. T2: submit(task)
      8. T2: = executeFront()
      9. T2: == semaphore.acquire() -> false
      10. T2: return without executing any task
      11. T1: return without executing any task

      Failure example: http://ci.infinispan.org/viewLog.html?buildId=27153&tab=buildResultsDiv&buildTypeId=Infinispan_MasterHotspotJdk8#testNameId3522947143330444111

      Attachments

        Issue Links

          Activity

            People

              dberinde@redhat.com Dan Berindei (Inactive)
              dberinde@redhat.com Dan Berindei (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: