code: private void resetWorkUnit(String reason) {
          StringWriter writer = new StringWriter();
          try (PrintWriter pw = new PrintWriter(writer)) {
              pw.printf("%s grabbed %s from queue but %s %s. ", getName(), workUnit, owner.getDisplayName(), reason);
              if (owner.getTerminatedBy().isEmpty()) {
                  pw.print("No termination trace available.");
              } else {
                  pw.println("Termination trace follows:");
                  for (Computer.TerminationRequest request : owner.getTerminatedBy()) {
                      Functions.printStackTrace(request, pw);
                  }
              }
          }
          LOGGER.log(WARNING, writer.toString());
          lock.writeLock().lock();
          try {
              if (executable != null) {
                  throw new IllegalStateException("Cannot reset the work unit after the executable has been created");
              }
              workUnit = null;
          } finally {
              lock.writeLock().unlock();
          }
      }
docs: There are some cases where an executor is started but the node is removed or goes off-line before we are ready
  to start executing the assigned work unit. This method is called to clear the assigned work unit so that
  the {@link Queue#maintain()} method can return the item to the buildable state.
  
  Note: once we create the {@link Executable} we cannot unwind the state and the build will have to end up being
  marked as a failure.