Program: 50342
Project: 50342
Buggy source:
/** 
 * Subsequent merge of multiple splits
 * @param toMerge   the splits to sort
 * @param lastMerge
 */
private void mergeSplits(final List<SortMergeSplit> toMerge,final boolean lastMerge){
  numSortMergesRunning.incrementAndGet();
  final Runnable toRun=new Runnable(){
    @Override public void run(){
      final String threadId=String.format("String_Node_Str",Thread.currentThread().getId());
      final List<String> mergeFromBasenames=new LinkedList<String>();
      try {
        System.gc();
        final SortMergeSplit merged=toMerge.get(0);
        final int numSplits=toMerge.size();
        for (int i=1; i < numSplits; i++) {
          merged.addRangesFomSplit(toMerge.get(i));
          merged.numFiles+=toMerge.get(i).numFiles;
        }
        merged.ranges=mergeRangeList(merged.ranges);
        LOG.debug(String.format("String_Node_Str",threadId,numSplits,ArrayUtils.toString(toMerge),ArrayUtils.toString(merged)));
        for (        final SortMergeSplit mergeFrom : toMerge) {
          final String inputBasename=tempDir + "String_Node_Str" + mergeFrom.tag;
          mergeFromBasenames.add(inputBasename);
        }
        final ConcatSortedAlignmentReader concatReader=new ConcatSortedAlignmentReader(false,mergeFromBasenames.toArray(new String[mergeFromBasenames.size()]));
        concatReader.readHeader();
        merged.makeNewTag();
        final String subBasename;
        final String subOutputFilename;
        if (lastMerge) {
          subBasename=FilenameUtils.getName(basename);
          subOutputFilename=outputFilename;
        }
 else {
          subBasename="String_Node_Str" + merged.tag;
          subOutputFilename=tempDir + "String_Node_Str" + subBasename;
        }
        final AlignmentWriter writer=new AlignmentWriter(subOutputFilename);
        writer.setSorted(true);
        if (concatReader.getTargetLength() != null) {
          writer.setTargetLengths(concatReader.getTargetLength());
        }
        for (        final Alignments.AlignmentEntry entry : concatReader) {
          writer.appendEntry(entry);
        }
        writer.close();
        numMergesExecuted.incrementAndGet();
        sortedSplits.add(merged);
      }
 catch (      IOException e) {
        LOG.error(String.format("String_Node_Str",threadId,e.getMessage()));
        exceptions.add(e);
      }
catch (      Throwable t) {
        LOG.error(String.format("String_Node_Str",threadId,t.getMessage()));
        exceptions.add(t);
      }
 finally {
        for (        final String mergeFromBasename : mergeFromBasenames) {
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
        }
      }
    }
  }
;
  if (executorService != null) {
    executorService.submit(toRun);
  }
 else {
    toRun.run();
  }
}

Fixed version (ground truth):
/** 
 * Subsequent merge of multiple splits
 * @param toMerge   the splits to sort
 * @param lastMerge
 */
private void mergeSplits(final List<SortMergeSplit> toMerge,final boolean lastMerge){
  numSortMergesRunning.incrementAndGet();
  final Runnable toRun=new Runnable(){
    @Override public void run(){
      final String threadId=String.format("String_Node_Str",Thread.currentThread().getId());
      final List<String> mergeFromBasenames=new LinkedList<String>();
      try {
        System.gc();
        final SortMergeSplit merged=toMerge.get(0);
        final int numSplits=toMerge.size();
        for (int i=1; i < numSplits; i++) {
          merged.addRangesFomSplit(toMerge.get(i));
          merged.numFiles+=toMerge.get(i).numFiles;
        }
        merged.ranges=mergeRangeList(merged.ranges);
        LOG.debug(String.format("String_Node_Str",threadId,numSplits,ArrayUtils.toString(toMerge),ArrayUtils.toString(merged)));
        for (        final SortMergeSplit mergeFrom : toMerge) {
          final String inputBasename=tempDir + "String_Node_Str" + mergeFrom.tag;
          mergeFromBasenames.add(inputBasename);
        }
        final ConcatSortedAlignmentReader concatReader=new ConcatSortedAlignmentReader(false,mergeFromBasenames.toArray(new String[mergeFromBasenames.size()]));
        concatReader.readHeader();
        merged.makeNewTag();
        final String subBasename;
        final String subOutputFilename;
        if (lastMerge) {
          subBasename=FilenameUtils.getName(basename);
          subOutputFilename=outputFilename;
        }
 else {
          subBasename="String_Node_Str" + merged.tag;
          subOutputFilename=tempDir + "String_Node_Str" + subBasename;
        }
        final AlignmentWriter writer=new AlignmentWriter(subOutputFilename);
        if (concatReader.getTargetLength() != null) {
          writer.setTargetLengths(concatReader.getTargetLength());
        }
        writer.setTargetIdentifiers(concatReader.getTargetIdentifiers());
        writer.setSorted(true);
        for (        final Alignments.AlignmentEntry entry : concatReader) {
          writer.appendEntry(entry);
        }
        writer.close();
        numMergesExecuted.incrementAndGet();
        sortedSplits.add(merged);
      }
 catch (      IOException e) {
        LOG.error(String.format("String_Node_Str",threadId,e.getMessage()));
        exceptions.add(e);
      }
catch (      Throwable t) {
        LOG.error(String.format("String_Node_Str",threadId,t.getMessage()));
        exceptions.add(t);
      }
 finally {
        for (        final String mergeFromBasename : mergeFromBasenames) {
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
          deleteFile(new File(mergeFromBasename + "String_Node_Str"),true);
        }
      }
    }
  }
;
  if (executorService != null) {
    executorService.submit(toRun);
  }
 else {
    toRun.run();
  }
}