Program: 161686
Project: 161686
Buggy source:
/** 
 * After a task has been pulled from the queue and is ready to execute it is provided here.   This function will get an available worker, waiting a bit of time for one to become  available if none are immediately available.  If after that there is still none available it  will create one (assuming we have not reached our max pool size).  Then the acquired worker  will be provided the task to execute.
 * @param task Task to execute once we have an available worker
 * @throws InterruptedException Thrown if thread is interrupted while waiting for a worker
 */
protected void runLowPriorityTask(TaskWrapper task) throws InterruptedException {
  Worker w=null;
synchronized (workersLock) {
    if (!shutdownFinishing) {
      long waitAmount;
      while (currentPoolSize >= maxPoolSize && availableWorkers.size() < WORKER_CONTENTION_LEVEL && !shutdownFinishing && !highPriorityConsumer.isQueueEmpty() && (waitAmount=task.getDelayEstimateInMillis() - lastHighDelay) > LOW_PRIORITY_WAIT_TOLLERANCE_IN_MS) {
        workersLock.wait(waitAmount);
        Clock.systemNanoTime();
      }
      if (highPriorityConsumer.isQueueEmpty()) {
        lastHighDelay=0;
      }
      if (!shutdownFinishing) {
        if (currentPoolSize >= maxPoolSize) {
          w=getExistingWorker(Long.MAX_VALUE);
        }
 else         if (currentPoolSize == 0) {
          w=makeNewWorker();
        }
 else {
          w=getExistingWorker(maxWaitForLowPriorityInMs);
          if (w == null) {
            if (currentPoolSize >= maxPoolSize) {
              w=getExistingWorker(Long.MAX_VALUE);
            }
 else {
              w=makeNewWorker();
            }
          }
        }
      }
    }
  }
  if (w != null) {
    w.nextTask(task);
  }
}

Fixed version (ground truth):
/** 
 * After a task has been pulled from the queue and is ready to execute it is provided here.   This function will get an available worker, waiting a bit of time for one to become  available if none are immediately available.  If after that there is still none available it  will create one (assuming we have not reached our max pool size).  Then the acquired worker  will be provided the task to execute.
 * @param task Task to execute once we have an available worker
 * @throws InterruptedException Thrown if thread is interrupted while waiting for a worker
 */
protected void runLowPriorityTask(TaskWrapper task) throws InterruptedException {
  Worker w=null;
synchronized (workersLock) {
    if (!shutdownFinishing) {
      long waitMs;
      while (currentPoolSize >= maxPoolSize && availableWorkers.size() < WORKER_CONTENTION_LEVEL && !shutdownFinishing && (waitMs=task.getDelayEstimateInMs() - lastHighDelayMillis) > LOW_PRIORITY_WAIT_TOLLERANCE_IN_MS) {
        workersLock.wait(waitMs);
        Clock.systemNanoTime();
      }
      if (!shutdownFinishing) {
        if (currentPoolSize >= maxPoolSize) {
          w=getExistingWorker(Long.MAX_VALUE);
        }
 else         if (currentPoolSize == 0) {
          w=makeNewWorker();
        }
 else {
          w=getExistingWorker(maxWaitForLowPriorityInMs);
          if (w == null) {
            if (currentPoolSize >= maxPoolSize) {
              w=getExistingWorker(Long.MAX_VALUE);
            }
 else {
              w=makeNewWorker();
            }
          }
        }
      }
    }
  }
  if (w != null) {
    w.nextTask(task);
  }
}