Program: 112416
Project: 112416
Buggy source:
public int scheduleIndexBuilds() throws Exception {
  ZooKeeperWatcher zookeeperWatcher=new ZooKeeperWatcher(conf,"String_Node_Str",null);
  if (!ZKBasedMasterElectionUtil.acquireLock(zookeeperWatcher,PHOENIX_LOCKS_PARENT,AUTO_INDEX_BUILD_LOCK_NAME)) {
    LOG.info("String_Node_Str");
    return -1;
  }
  Map<String,PhoenixAsyncIndex> candidateJobs=getCandidateJobs();
  LOG.info("String_Node_Str" + candidateJobs);
  Set<String> submittedJobs=getSubmittedYarnApps();
  LOG.info("String_Node_Str" + submittedJobs);
  Set<PhoenixAsyncIndex> jobsToSchedule=getJobsToSubmit(candidateJobs,submittedJobs);
  LOG.info("String_Node_Str" + jobsToSchedule);
  List<Future<Boolean>> results=new ArrayList<Future<Boolean>>(jobsToSchedule.size());
  int failedJobSubmissionCount=0;
  int timedoutJobSubmissionCount=0;
  ExecutorService jobSubmitPool=Executors.newFixedThreadPool(10);
  LOG.info("String_Node_Str" + jobsToSchedule);
  try {
    for (    PhoenixAsyncIndex indexToBuild : jobsToSchedule) {
      PhoenixMRJobCallable task=new PhoenixMRJobCallable(HBaseConfiguration.create(conf),indexToBuild,"String_Node_Str");
      results.add(jobSubmitPool.submit(task));
    }
    for (    Future<Boolean> result : results) {
      try {
        result.get(JOB_SUBMIT_POOL_TIMEOUT,TimeUnit.MINUTES);
      }
 catch (      InterruptedException e) {
        failedJobSubmissionCount++;
      }
catch (      ExecutionException e) {
        failedJobSubmissionCount++;
      }
catch (      TimeoutException e) {
        timedoutJobSubmissionCount++;
      }
    }
  }
  finally {
    PhoenixMRJobUtil.shutdown(jobSubmitPool);
  }
  LOG.info("String_Node_Str" + jobsToSchedule.size() + "String_Node_Str"+ failedJobSubmissionCount+ "String_Node_Str"+ timedoutJobSubmissionCount);
  return failedJobSubmissionCount;
}

Fixed version (ground truth):
public int scheduleIndexBuilds() throws Exception {
  ZKWatcher zookeeperWatcher=new ZKWatcher(conf,"String_Node_Str",null);
  if (!ZKBasedMasterElectionUtil.acquireLock(zookeeperWatcher,PHOENIX_LOCKS_PARENT,AUTO_INDEX_BUILD_LOCK_NAME)) {
    LOG.info("String_Node_Str");
    return -1;
  }
  Map<String,PhoenixAsyncIndex> candidateJobs=getCandidateJobs();
  LOG.info("String_Node_Str" + candidateJobs);
  Set<String> submittedJobs=getSubmittedYarnApps();
  LOG.info("String_Node_Str" + submittedJobs);
  Set<PhoenixAsyncIndex> jobsToSchedule=getJobsToSubmit(candidateJobs,submittedJobs);
  LOG.info("String_Node_Str" + jobsToSchedule);
  List<Future<Boolean>> results=new ArrayList<Future<Boolean>>(jobsToSchedule.size());
  int failedJobSubmissionCount=0;
  int timedoutJobSubmissionCount=0;
  ExecutorService jobSubmitPool=Executors.newFixedThreadPool(10);
  LOG.info("String_Node_Str" + jobsToSchedule);
  try {
    for (    PhoenixAsyncIndex indexToBuild : jobsToSchedule) {
      PhoenixMRJobCallable task=new PhoenixMRJobCallable(HBaseConfiguration.create(conf),indexToBuild,"String_Node_Str");
      results.add(jobSubmitPool.submit(task));
    }
    for (    Future<Boolean> result : results) {
      try {
        result.get(JOB_SUBMIT_POOL_TIMEOUT,TimeUnit.MINUTES);
      }
 catch (      InterruptedException e) {
        failedJobSubmissionCount++;
      }
catch (      ExecutionException e) {
        failedJobSubmissionCount++;
      }
catch (      TimeoutException e) {
        timedoutJobSubmissionCount++;
      }
    }
  }
  finally {
    PhoenixMRJobUtil.shutdown(jobSubmitPool);
  }
  LOG.info("String_Node_Str" + jobsToSchedule.size() + "String_Node_Str"+ failedJobSubmissionCount+ "String_Node_Str"+ timedoutJobSubmissionCount);
  return failedJobSubmissionCount;
}