Will be run if the async task raises an unhandled exception.
438446
def handle_an_error():
    """"""
    import os

    from furious.context import get_current_async

    async = get_current_async()
    async_exception = async.result.payload
    exc_info = async_exception.traceback
    logging.info('async job blew up, exception info: %r', exc_info)

    retries = int(os.environ['HTTP_X_APPENGINE_TASKRETRYCOUNT'])
    if retries < 2:
        raise Exception(async_exception.error)
    else:
        logging.info('Caught too many errors, giving up now.')
865573
public static void call(Runnable task) {
        try {
            call(() -> {
                task.run();
                return true;
            });
        } catch (Exception e) {
            // It's safe to throw unsafely here because the Callable we passed never throws a checked exception.
            Exceptions.throwUnsafely(e);
        }
    }
1366729
def _wait(self):
        
        val = self.wait_change.get()

        if isinstance(val, Exception):
            # Don't other uncharging, because execution is going to stop
            raise val
        else:
            # Uncharge for resources.
            self.member_burden -= len(val)
            self.concurrency_burden -= 1
1310675
public void abort(Throwable t) {
        // Set the result to the given exception
        boolean abortSuccessful = getResultFuture().completeExceptionally(t);

        if (abortSuccessful) {
            // Attempt to abort the task
            getTaskFuture().cancel(true);
        }
    }
10115
private synchronized void ensureIsRun() {
        if (!isRun) {
            isRun = true;
            try {
                result = executeProc(args);
                exception = null;
            } catch (ProcError e) {
                throw e.asRuntimeException();
            } catch (Throwable t) {
                exception = t;
                result = null;
            }
        }
    }
1333673
private ChannelFuture checkException(ChannelPromise promise) {
      Throwable t = lastException;
      if (t != null) {
        lastException = null;

        if (promise.isVoid()) {
            PlatformDependent.throwException(t);
        }

        return promise.setFailure(t);
      }

      return promise.setSuccess();
    }
665800
public void dispatchAsynchException(ProxyQueue proxyQueue, Exception exception)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dispatchAsynchException",
                                           new Object[] { proxyQueue, exception });

      // Create a runnable with the data
      AsynchExceptionThread thread = new AsynchExceptionThread(proxyQueue, exception);
      dispatchThread(thread);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dispatchAsynchException");
   }
687398
def join(self):
        
        pending = set()
        exceptions = set()
        while len(self._tasks) > 0 or len(pending) > 0:
            while len(self._tasks) > 0 and len(pending) < self._concurrency:
                task, args, kwargs = self._tasks.pop(0)
                pending.add(task(*args, **kwargs))
            (done, pending) = yield from asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED)
            for task in done:
                if task.exception():
                    exceptions.add(task.exception())
        if len(exceptions) > 0:
            raise exceptions.pop()
614667
public void awaitUninterruptibly() {
        boolean interrupted = Thread.interrupted();
        try {
            while (true) {
                try {
                    await();
                    break;
                } catch (InterruptedException ie) {
                    interrupted = true;
                }
            }
        } finally {
            if (interrupted) Thread.currentThread().interrupt();
        }
    }
552055
def run_callback(self):
        

        if self._callback_func is not None:
            try:
                self._callback_func(self._request, self._result)
            except Exception:  # pylint: disable=broad-except
                LOGGER.exception('An unhandled error occurred while running '
                                 'future callback')
704989
def run(self):
        
        while True:
            task = self.tasks_queue.get()
            if task is None:
                self.tasks_queue.task_done()
                break
            # No exception detected in any thread,
            # continue the execution.
            if self.exceptions_queue.empty():
                try:
                    # Execute the task
                    func, args, kargs = task
                    result = func(*args, **kargs)
                    self.results_queue.put(result)
                except Exception as e:
                    self.exceptions_queue.put(e)
            # Mark this task as done, whether an exception happened or not
            self.tasks_queue.task_done()
337050
@Override
    public void run() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "run", Thread.currentThread().getName() + " " + this.in.getReadListener());
        }
        
        try {     
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Issuing the async read for the data");
            }
            
            if (_isc==null) {
                
                _callback.complete(null);
            
            } else {
                //Call into the HttpInboundService context for the body data, passing in the callback and forcing
                //the read to go asynchronous
                //If there is data immediately available Channel will call the callback.complete before returning to this thread
                _isc.getRequestBodyBuffer(_callback, true);
            }
        } catch (Exception e){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "An exception occurred during the async read : " + e);
            }
            e.printStackTrace();
            //There was a problem with the read so we should invoke their onError, since technically it's been set now
            if(this.in.getReadListener()!= null)
                this.in.getReadListener().onError(e);
        } finally {
            asyncContext.setReadListenerRunning(false);
        }
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "run", this.in.getReadListener());
        }
    }
316907
def _future_completed(future):
    
    exc = future.exception()
    if exc:
        log.debug("Failed to run task on executor", exc_info=exc)
890550
async def run_async_task(self, container, asynctask, newthread = True):
        ""
        e = TaskEvent(self, async_task = asynctask, newthread = newthread)
        await container.wait_for_send(e)
        ev = await TaskDoneEvent.createMatcher(e)
        if hasattr(ev, 'exception'):
            raise ev.exception
        else:
            return ev.result
358467
public void deliverAsyncException(Throwable e)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "deliverAsyncException", e);

      if (proxyQueue != null)
      {
         proxyQueue.deliverException(e);
      }
      else
      {
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "** Odd - we are not async?!");
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "deliverAsyncException");
   }
117188
def notify_exception(self, exception, run_done_callbacks=True):
        '''  '''
        logger.error("%s : %s" % (exception.__class__.__name__, str(exception)))
        self._exception = exception
        if self.is_running(True):
            # wait for a short 5 seconds for it to finish
            for _cnt in range(0, 5):
                if not self._cancel():
                    time.sleep(1)
                else:
                    break

        self.notify_done(error=True, run_done_callbacks=run_done_callbacks)
231049
private void handleTaskException(final TaskClientCodeException e) {

    LOG.log(Level.SEVERE, "TaskClientCodeException", e);

    final ByteString exception = ByteString.copyFrom(this.exceptionCodec.toBytes(e.getCause()));

    final ReefServiceProtos.TaskStatusProto taskStatus =
        ReefServiceProtos.TaskStatusProto.newBuilder()
            .setContextId(e.getContextId())
            .setTaskId(e.getTaskId())
            .setResult(exception)
            .setState(ReefServiceProtos.State.FAILED)
            .build();

    LOG.log(Level.SEVERE, "Sending heartbeat: {0}", taskStatus);

    this.heartBeatManager.sendTaskStatus(taskStatus);
  }