Program: 5176
Project: 5176
Buggy source:
private void startFlushThread(){
  flushThread=new Thread("String_Node_Str"){
    @Override public void run(){
      while ((!isInterrupted()) && (!stopped)) {
        long now=System.currentTimeMillis();
        if (now > (lastChecked + pruneFlushInterval)) {
          try {
            User.runAsLoginUser(new PrivilegedExceptionAction<Void>(){
              @Override public Void run() throws Exception {
                while (!pruneEntries.isEmpty()) {
                  Map.Entry<byte[],Long> firstEntry=pruneEntries.firstEntry();
                  dataJanitorState.savePruneUpperBoundForRegion(firstEntry.getKey(),firstEntry.getValue());
                  pruneEntries.remove(firstEntry.getKey(),firstEntry.getValue());
                }
                while (!emptyRegions.isEmpty()) {
                  Map.Entry<byte[],Long> firstEntry=emptyRegions.firstEntry();
                  dataJanitorState.saveEmptyRegionForTime(firstEntry.getValue(),firstEntry.getKey());
                  emptyRegions.remove(firstEntry.getKey(),firstEntry.getValue());
                }
                return null;
              }
            }
);
          }
 catch (          IOException ex) {
            LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
          }
          lastChecked=now;
        }
        try {
          TimeUnit.SECONDS.sleep(1);
        }
 catch (        InterruptedException ex) {
          interrupt();
          break;
        }
      }
      LOG.info("String_Node_Str");
    }
  }
;
  flushThread.setDaemon(true);
  flushThread.start();
}

Fixed version (ground truth):
private void startFlushThread(){
  flushThread=new Thread("String_Node_Str"){
    @Override public void run(){
      while ((!isInterrupted()) && (!stopped)) {
        long now=System.currentTimeMillis();
        if (now > (lastChecked + pruneFlushInterval)) {
          try {
            UserGroupInformation.getLoginUser().doAs(new PrivilegedExceptionAction<Void>(){
              @Override public Void run() throws Exception {
                while (!pruneEntries.isEmpty()) {
                  Map.Entry<byte[],Long> firstEntry=pruneEntries.firstEntry();
                  dataJanitorState.savePruneUpperBoundForRegion(firstEntry.getKey(),firstEntry.getValue());
                  pruneEntries.remove(firstEntry.getKey(),firstEntry.getValue());
                }
                while (!emptyRegions.isEmpty()) {
                  Map.Entry<byte[],Long> firstEntry=emptyRegions.firstEntry();
                  dataJanitorState.saveEmptyRegionForTime(firstEntry.getValue(),firstEntry.getKey());
                  emptyRegions.remove(firstEntry.getKey(),firstEntry.getValue());
                }
                return null;
              }
            }
);
          }
 catch (          IOException|InterruptedException ex) {
            handleException(ex);
          }
          lastChecked=now;
        }
        try {
          TimeUnit.SECONDS.sleep(1);
        }
 catch (        InterruptedException ex) {
          interrupt();
          break;
        }
      }
      LOG.info("String_Node_Str");
    }
  }
;
  flushThread.setDaemon(true);
  flushThread.start();
}