Program: 161649
Project: 161649
Buggy source:
/** 
 * The ultimate start call for the profiler.  This handles all possible start permutations.   If an   {@link Executor} is provided, that will be used to run the profiler thread.  If there is a duration provided > 0, a thread will be started to perform profiler shutdown.  If  {@code sampleDurationInMillis} is greater than {@code 0} and the profiler is already running, it will be stopped and restarted.
 * @param executor Executor or scheduler to use for execution as possible
 * @param sampleDurationInMillis if greater than {@code 0} an automatic stop will occur after that many milliseconds 
 * @param completionFuture If not {@code null} future will be called once the next {@link #stop()} is invoked
 */
private void start(Executor executor,final long sampleDurationInMillis,SettableListenableFuture<String> completionFuture){
synchronized (startStopLock) {
    if (sampleDurationInMillis > 0) {
      stop();
    }
    if (completionFuture != null) {
      stopFutures.add(completionFuture);
    }
    if (pStore.collectorThread.get() == null) {
      final ProfilerRunner pr=new ProfilerRunner(pStore);
      if (executor == null) {
        Thread thread=new Thread(pr);
        pStore.collectorThread.set(thread);
        thread.setName("String_Node_Str");
        thread.setPriority(Thread.MAX_PRIORITY);
        thread.start();
      }
 else {
        final SettableListenableFuture<?> runningThreadFuture;
        runningThreadFuture=new SettableListenableFuture<>();
        executor.execute(() -> {
          try {
            if (!pStore.collectorThread.compareAndSet(null,Thread.currentThread())) {
              return;
            }
          }
  finally {
            runningThreadFuture.setResult(null);
          }
          pr.run();
        }
);
        try {
          runningThreadFuture.get();
        }
 catch (        InterruptedException e) {
          Thread.currentThread().interrupt();
          return;
        }
catch (        ExecutionException e) {
          throw ExceptionUtils.makeRuntime(e.getCause());
        }
      }
      if (sampleDurationInMillis > 0) {
        pStore.dumpLoopRun=new Runnable(){
          private final long startTime=Clock.accurateForwardProgressingMillis();
          @Override public void run(){
            if (Clock.lastKnownForwardProgressingMillis() - startTime > sampleDurationInMillis) {
              pStore.dumpLoopRun=null;
              stop();
            }
          }
        }
;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * The ultimate start call for the profiler.  This handles all possible start permutations.   If an   {@link Executor} is provided, that will be used to run the profiler thread.  If there is a duration provided > 0, a thread will be started to perform profiler shutdown.  If  {@code sampleDurationInMillis} is greater than {@code 0} and the profiler is already running, it will be stopped and restarted.
 * @param executor Executor or scheduler to use for execution as possible
 * @param sampleDurationInMillis if greater than {@code 0} an automatic stop will occur after that many milliseconds 
 * @param completionFuture If not {@code null} future will be called once the next {@link #stop()} is invoked
 */
private void start(Executor executor,final long sampleDurationInMillis,SettableListenableFuture<String> completionFuture){
  final ProfilerRunner pr=new ProfilerRunner(pStore);
  boolean runInCallingThread=false;
  Thread callingThread=null;
synchronized (startStopLock) {
    if (sampleDurationInMillis > 0) {
      stop();
    }
    if (completionFuture != null) {
      stopFutures.add(completionFuture);
    }
    if (pStore.collectorThread.get() == null) {
      if (executor == null) {
        Thread thread=new Thread(pr);
        pStore.collectorThread.set(thread);
        thread.setName("String_Node_Str");
        thread.setPriority(Thread.MAX_PRIORITY);
        thread.start();
      }
 else       if (executor == SameThreadSubmitterExecutor.instance() || executor instanceof SameThreadSubmitterExecutor) {
        callingThread=Thread.currentThread();
        pStore.collectorThread.set(callingThread);
        runInCallingThread=true;
      }
 else {
        final SettableListenableFuture<?> runningThreadFuture;
        runningThreadFuture=new SettableListenableFuture<>();
        executor.execute(() -> {
          Thread currentThread=Thread.currentThread();
          try {
            if (!pStore.collectorThread.compareAndSet(null,currentThread)) {
              return;
            }
          }
  finally {
            runningThreadFuture.setResult(null);
          }
          String originalName=currentThread.getName();
          int origPriority=currentThread.getPriority();
          try {
            if (origPriority < Thread.MAX_PRIORITY) {
              currentThread.setPriority(Thread.MAX_PRIORITY);
            }
            currentThread.setName("String_Node_Str" + originalName + "String_Node_Str");
            pr.run();
          }
  finally {
            if (origPriority < Thread.MAX_PRIORITY) {
              currentThread.setPriority(origPriority);
            }
            currentThread.setName(originalName);
          }
        }
);
        try {
          runningThreadFuture.get();
        }
 catch (        InterruptedException e) {
          Thread.currentThread().interrupt();
          return;
        }
catch (        ExecutionException e) {
          throw ExceptionUtils.makeRuntime(e.getCause());
        }
      }
      if (sampleDurationInMillis > 0) {
        pStore.dumpLoopRun=new Runnable(){
          private final long startTime=Clock.accurateForwardProgressingMillis();
          @Override public void run(){
            if (Clock.lastKnownForwardProgressingMillis() - startTime > sampleDurationInMillis) {
              pStore.dumpLoopRun=null;
              stop();
            }
          }
        }
;
      }
    }
  }
  if (runInCallingThread) {
    int origPriority=callingThread.getPriority();
    try {
      if (origPriority < Thread.MAX_PRIORITY) {
        callingThread.setPriority(Thread.MAX_PRIORITY);
      }
      pr.run();
    }
  finally {
      if (origPriority < Thread.MAX_PRIORITY) {
        callingThread.setPriority(origPriority);
      }
    }
    Thread.interrupted();
  }
}