Program: 17279
Project: 17279
Buggy source:
@Override public Void call() throws Exception {
  while (numCompletedInputs.get() < numInputs) {
    if (numRunningFetchers.get() >= numFetchers || pendingHosts.size() == 0) {
      lock.lock();
      try {
        wakeLoop.await();
      }
  finally {
        lock.unlock();
      }
      if (shuffleError != null) {
        break;
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug("String_Node_Str" + numCompletedInputs);
      }
      if (numCompletedInputs.get() < numInputs) {
        lock.lock();
        try {
          int numFetchersToRun=Math.min(pendingHosts.size(),numFetchers - numRunningFetchers.get());
          int count=0;
          for (Iterator<InputHost> inputHostIter=pendingHosts.iterator(); inputHostIter.hasNext(); ) {
            InputHost inputHost=inputHostIter.next();
            inputHostIter.remove();
            if (inputHost.getNumPendingInputs() > 0) {
              Fetcher fetcher=constructFetcherForHost(inputHost);
              LOG.info("String_Node_Str" + inputHost);
              numRunningFetchers.incrementAndGet();
              ListenableFuture<FetchResult> future=fetcherExecutor.submit(fetcher);
              Futures.addCallback(future,fetchFutureCallback);
              if (++count >= numFetchersToRun) {
                break;
              }
            }
          }
        }
  finally {
          lock.unlock();
        }
      }
    }
  }
  if (!fetcherExecutor.isShutdown()) {
    fetcherExecutor.shutdownNow();
  }
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  while (numCompletedInputs.get() < numInputs) {
    if (numRunningFetchers.get() >= numFetchers || pendingHosts.size() == 0) {
      lock.lock();
      try {
        wakeLoop.await();
      }
  finally {
        lock.unlock();
      }
    }
    if (shuffleError != null) {
      break;
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + numCompletedInputs);
    }
    if (numCompletedInputs.get() < numInputs) {
      lock.lock();
      try {
        int numFetchersToRun=Math.min(pendingHosts.size(),numFetchers - numRunningFetchers.get());
        int count=0;
        while (pendingHosts.peek() != null) {
          InputHost inputHost=pendingHosts.take();
          if (LOG.isDebugEnabled()) {
            LOG.debug("String_Node_Str" + inputHost);
          }
          if (inputHost.getNumPendingInputs() > 0) {
            LOG.info("String_Node_Str" + inputHost);
            Fetcher fetcher=constructFetcherForHost(inputHost);
            numRunningFetchers.incrementAndGet();
            ListenableFuture<FetchResult> future=fetcherExecutor.submit(fetcher);
            Futures.addCallback(future,fetchFutureCallback);
            if (++count >= numFetchersToRun) {
              break;
            }
          }
 else {
            if (LOG.isDebugEnabled()) {
              LOG.debug("String_Node_Str" + inputHost.getHost() + "String_Node_Str");
            }
          }
        }
      }
  finally {
        lock.unlock();
      }
    }
  }
  LOG.info("String_Node_Str");
  if (!fetcherExecutor.isShutdown()) {
    fetcherExecutor.shutdownNow();
  }
  return null;
}