code: private void startNewTask(TaskInProgress tip) {
      try {
        boolean launched = localizeAndLaunchTask(tip);
        if (!launched) {
          // Free the slot.
          tip.kill(true);
          tip.cleanup(true);
        }
      } catch (Throwable e) {
        String msg = ("Error initializing " + tip.getTask().getTaskID() +
                      ":\n" + StringUtils.stringifyException(e));
        LOG.error(msg, e);
        tip.reportDiagnosticInfo(msg);
        try {
          tip.kill(true);
          tip.cleanup(true);
        } catch (IOException ie2) {
          LOG.info("Error cleaning up " + tip.getTask().getTaskID() + ":\n" +
                   StringUtils.stringifyException(ie2));
        }
  
        // Careful!
        // This might not be an 'Exception' - don't handle 'Error' here!
        if (e instanceof Error) {
          throw ((Error) e);
        }
      }
    }
docs: Start a new task.
  All exceptions are handled locally, so that we don't mess up the
  task tracker.