Terminates this flow with an error.
768599
def Error(self, backtrace, client_id=None, status_code=None):
    """"""
    try:
      self.queue_manager.DestroyFlowStates(self.session_id)
    except queue_manager.MoreDataException:
      pass

    if not self.IsRunning():
      return

    # Set an error status
    reply = rdf_flows.GrrStatus()
    if status_code is None:
      reply.status = rdf_flows.GrrStatus.ReturnedStatus.GENERIC_ERROR
    else:
      reply.status = status_code

    client_id = client_id or self.runner_args.client_id

    if backtrace:
      reply.error_message = backtrace
      logging.error("Error in flow %s (%s). Trace: %s", self.session_id,
                    client_id, backtrace)
      self.context.backtrace = backtrace
    else:
      logging.error("Error in flow %s (%s).", self.session_id, client_id)

    self._SendTerminationMessage(reply)

    self.context.state = rdf_flow_runner.FlowContext.State.ERROR

    if self.ShouldSendNotifications():
      flow_ref = None
      if client_id:
        flow_ref = rdf_objects.FlowReference(
            client_id=client_id.Basename(), flow_id=self.session_id.Basename())
      notification_lib.Notify(
          self.token.username,
          rdf_objects.UserNotification.Type.TYPE_FLOW_RUN_FAILED,
          "Flow (%s) terminated due to error" % self.session_id,
          rdf_objects.ObjectReference(
              reference_type=rdf_objects.ObjectReference.Type.FLOW,
              flow=flow_ref))

    self.flow_obj.Flush()
796441
public function stop()
    {
        if ($this->started) {
            if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
                $this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');
                if ($evt->bubbleCancelled()) {
                    return;
                }
            }

            try {
                $this->executeCommand("QUIT\r\n", [221]);
            } catch (Swift_TransportException $e) {
            }

            try {
                $this->buffer->terminate();

                if ($evt) {
                    $this->eventDispatcher->dispatchEvent($evt, 'transportStopped');
                }
            } catch (Swift_TransportException $e) {
                $this->throwException($e);
            }
        }
        $this->started = false;
    }
950443
def _TerminateFlow(rdf_flow,
                   reason=None,
                   flow_state=rdf_flow_objects.Flow.FlowState.ERROR):
  """"""
  flow_cls = registry.FlowRegistry.FlowClassByName(rdf_flow.flow_class_name)
  flow_obj = flow_cls(rdf_flow)

  if not flow_obj.IsRunning():
    # Nothing to do.
    return

  logging.info("Terminating flow %s on %s, reason: %s", rdf_flow.flow_id,
               rdf_flow.client_id, reason)

  rdf_flow.flow_state = flow_state
  rdf_flow.error_message = reason
  flow_obj.NotifyCreatorOfError()

  data_store.REL_DB.UpdateFlow(
      rdf_flow.client_id,
      rdf_flow.flow_id,
      flow_obj=rdf_flow,
      processing_on=None,
      processing_since=None,
      processing_deadline=None)
  data_store.REL_DB.DeleteAllFlowRequestsAndResponses(rdf_flow.client_id,
                                                      rdf_flow.flow_id)
54824
def terminate(self):
        """"""
        for t in self._threads:
            t.quit()
        self._thread = []
        self._workers = []
683707
function (err, length, data) {
    if (err) {
      if (self.autoClose) {
        self.destroy()
      }
      self.emit('error', err)
    }
    self.push(data)
    // self.once('finish', self.close)
  }
318153
void terminateRequest() {
        int oldVal = state;
        if (allAreSet(oldVal, FLAG_REQUEST_TERMINATED)) {
            // idempotent
            return;
        }
        if (requestChannel != null) {
            requestChannel.requestDone();
        }
        this.state = oldVal | FLAG_REQUEST_TERMINATED;
        if (anyAreSet(oldVal, FLAG_RESPONSE_TERMINATED)) {
            invokeExchangeCompleteListeners();
        }
    }
1215624
def close(self):
    """"""
    self.acquire()
    try:
      self.flush()
      try:
        # Do not close the stream if it's sys.stderr|stdout. They may be
        # redirected or overridden to files, which should be managed by users
        # explicitly.
        if self.stream not in (sys.stderr, sys.stdout) and (
            not hasattr(self.stream, 'isatty') or not self.stream.isatty()):
          self.stream.close()
      except ValueError:
        # A ValueError is thrown if we try to run isatty() on a closed file.
        pass
      super(PythonHandler, self).close()
    finally:
      self.release()
224554
private void internalClose(Status internalError) {
    log.log(Level.WARNING, "Cancelling the stream with status {0}", new Object[] {internalError});
    stream.cancel(internalError);
    serverCallTracer.reportCallEnded(internalError.isOk()); // error so always false
  }
932217
private void handleEnd(GuacamoleInstruction instruction) {

        // Verify all required arguments are present
        List<String> args = instruction.getArgs();
        if (args.size() < 1)
            return;

        // Terminate stream
        closeInterceptedStream(args.get(0));

    }
238739
def close_stream_on_error(func):
    ''''''
    @asyncio.coroutine
    @functools.wraps(func)
    def wrapper(self, *args, **kwargs):
        with wpull.util.close_on_error(self.close):
            return (yield from func(self, *args, **kwargs))
    return wrapper
730647
void stopIfNecessary() {
    synchronized (lock) {
      if (goAway && !stopped && streams.size() == 0) {
        stopped = true;
      } else {
        return;
      }
    }
    listener.transportTerminated();
  }
1332706
async def cancel(self):
        
        if self._cancel_done:
            raise ProtocolError('Stream was already cancelled')

        with self._wrapper:
            await self._stream.reset()  # TODO: specify error code
            self._cancel_done = True
1314259
def abort(self, err):
        """"""
        if _debug: IOQueue._debug("abort %r", err)

        # send aborts to all of the members
        try:
            for iocb in self.queue:
                iocb.ioQueue = None
                iocb.abort(err)

            # flush the queue
            self.queue = []

            # the queue is now empty, clear the event
            self.notempty.clear()
        except ValueError:
            pass
1280736
@Override
    public void stop() {
        try {
            expectSupport.close();
        } catch (IOException e) {
            log(e, Project.MSG_DEBUG);
        }
    }
1354118
def abort(self):
        
        self._coll.chunks.delete_many(
            {"files_id": self._file['_id']}, session=self._session)
        self._coll.files.delete_one(
            {"_id": self._file['_id']}, session=self._session)
        object.__setattr__(self, "_closed", True)
858830
function() {
				this.abort();

				if (_fr) {
					_fr.getRuntime().exec.call(this, 'FileReader', 'destroy');
					_fr.disconnectRuntime();
				}

				self = _fr = null;
			}
1104114
def exit_on_error(self):
        """"""
        if self.exit_code:
            if self.errmsg is not None:
                logger.show("Exiting due to " + self.errmsg + ".")
                self.errmsg = None
            if self.using_jobs:
                kill_children()
            sys.exit(self.exit_code)