Check if any operations in progress need to be timed out

        Adds the corresponding finish action that fails the request due to a
        timeout.
480160
def _check_timeouts(self):
        

        for conn_id, data in self._connections.items():
            if 'timeout' in data and data['timeout'].expired:
                if data['state'] == self.Connecting:
                    self.finish_connection(conn_id, False, 'Connection attempt timed out')
                elif data['state'] == self.Disconnecting:
                    self.finish_disconnection(conn_id, False, 'Disconnection attempt timed out')
                elif data['state'] == self.InProgress:
                    if data['microstate'] == 'rpc':
                        self.finish_operation(conn_id, False, 'RPC timed out without response', None, None)
                    elif data['microstate'] == 'open_interface':
                        self.finish_operation(conn_id, False, 'Open interface request timed out')
1032002
def action_timeout=(t)
      t = t.to_f
      raise ArgumentError.new('Value must be great than zero or nil') unless t > 0
      @action_timeout = t
      t
    end
209763
def _declareTimeoutExceeded(self, ev_data: UpgradeLogData):
        
        logger.info("Timeout exceeded for {}:{}"
                    .format(ev_data.when, ev_data.version))
        last = self._actionLog.last_event
        # TODO test this
        if (last and last.ev_type == UpgradeLog.Events.failed and
                last.data == ev_data):
            return None

        self._action_failed(ev_data, reason="exceeded upgrade timeout")

        self._unscheduleAction()
        self._actionFailedCallback()
408731
public synchronized void timeoutTransaction(boolean initial) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "timeoutTransaction", initial);

        if (tc.isEventEnabled())
            Tr.event(tc, "(SPI) Transaction TIMEOUT occurred for TX: " + getLocalTID());

        _timedOut = true; // mark
        _rollbackOnly = true; // for the case of server quiesce?

        // inactivity timeout may have happened ... check status
        if (_status.getState() == TransactionState.STATE_ACTIVE) {
            // If there is no txn timeout, or we are into completion phase the timeout setting may be zero
            if (_timeout == 0)
                _timeout = 10;
            TimeoutManager.setTimeout(this, TimeoutManager.REPEAT_TIMEOUT, _timeout);
        }

        // Story 132693: JDBC4.1 allows connections to be aborted. Only call abort on the initial
        // call, not on retries.
        if (initial)
            abortTransactionParticipants();

        if (tc.isEntryEnabled())
            Tr.exit(tc, "timeoutTransaction");
    }
1260148
def checkTimeout(self, now):
        """"""
        log.debug("checking for timeout on session %s", self)
        if now - self.last_update > self.timeout:
            raise TftpTimeout("Timeout waiting for traffic")
891588
def _did_timeout(self):
        

        bambou_logger.debug('Bambou %s on %s has timeout (timeout=%ss)..' % (self._request.method, self._request.url, self.timeout))
        self._has_timeouted = True

        if self.async:
            self._callback(self)
        else:
            return self
230335
def process(self, *args, **kwargs):
        
        try:
            timeout_seconds = self.timeout_timedelta.total_seconds()
            with timeout(self.run, timeout_seconds) as run:
                run(*args, **kwargs)
        except Exception as e:
            if self.verbose:
                if isinstance(e, TimeoutError):
                    logger.error('SafeTask timed out: %s', e, exc_info=True)
                else:
                    logger.error('Error running SafeTask: %s',
                                 e, exc_info=True)
            self.on_error(e, *args, **kwargs)
        else:
            self.on_success(*args, **kwargs)
        finally:
            self.on_completion(*args, **kwargs)
89936
def _declareTimeoutExceeded(self, ev_data: RestartLogData):
        
        logger.info("Timeout exceeded for {}".format(ev_data.when))
        last = self._actionLog.last_event
        if (last and last.ev_type == RestartLog.Events.failed and
                last.data == ev_data):
            return None

        self._action_failed(ev_data,
                            reason="exceeded restart timeout")

        self._unscheduleAction()
        self._actionFailedCallback()
140540
public boolean waitForCompletion() {
        try {
            return completed.get();
        } catch (InterruptedException | ExecutionException e) {
            log.warn("Failed to wait for server completion", e);
        }

        return false;
    }
509137
public ManagerResponse sendAction(ManagerAction action, long timeout)
            throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException
    {
        ResponseHandlerResult result = new ResponseHandlerResult();
        SendActionCallback callbackHandler = new DefaultSendActionCallback(result);

        sendAction(action, callbackHandler);

        // definitely return null for the response of user events
        if (action instanceof UserEventAction)
        {
            return null;
        }

        // only wait if we did not yet receive the response.
        // Responses may be returned really fast.
        if (result.getResponse() == null)
        {
            try
            {
                result.await(timeout);
            }
            catch (InterruptedException ex)
            {
                logger.warn("Interrupted while waiting for result");
                Thread.currentThread().interrupt();
            }
        }

        // still no response?
        if (result.getResponse() == null)
        {
            throw new TimeoutException("Timeout waiting for response to " + action.getAction()
                    + (action.getActionId() == null ? "" : " (actionId: " + action.getActionId() + ")"));
        }

        return result.getResponse();
    }
1236316
def _maybe_stop_timeout():
    
    global _timeout

    if _timeout is not None:
        LOGGER.debug('Removing the pending timeout (%r)', _timeout)
        ioloop.IOLoop.current().remove_timeout(_timeout)
        _timeout = None
532849
def wait(self, timeout=None):
        
        self.ev_done.wait(timeout=timeout)

        if not self.ev_done.is_set():
            raise TaskTimeout("Task %s timed out." % self)

        # --> self.result is set
        # If it is an exception, then raise it in this waiter
        if isinstance(self.result, Exception):
            raise self.result

        # Release waiters and perform callbacks
        # done() has already been called, because of self.ev_done check
        # "asynchronous" tasks should could call done() here
        #self.done(self.result)

        return self.result
1130016
def check_for_stalled_tasks():
    
    from api.models.tasks import Task
    for task in Task.objects.filter(status_is_running=True):
        if not task.is_responsive():
            task.system_error()
        if task.is_timed_out():
            task.timeout_error()
1133744
public void onFailure(Throwable t) {

        if ((t instanceof StatusCodeException) && (((StatusCodeException)t).getStatusCode() == 0)) {
            // a status code 0 indicates the client aborted the request, most likely when leaving the page, this should be ignored
            return;
        } else if ((t instanceof StatusCodeException) && (((StatusCodeException)t).getStatusCode() == 500)) {
            // a server error 500 most likely indicates an expired session and there for insufficient user rights to access any GWT service
            CmsErrorDialog dialog = new CmsErrorDialog(Messages.get().key(Messages.GUI_SESSION_EXPIRED_0), null);
            dialog.center();
        } else {
            CmsErrorDialog.handleException(t);
        }
        // remove the overlay
        stop(false);
    }
164640
@Override
   public boolean complete(T value) {
      cancelTimeoutTask();
      repository.removeRequest(requestId);
      return super.complete(value);
   }
1257942
def _wait_for_completion(conn, promise, wait_timeout, msg):
    '''
    
    '''
    if not promise:
        return
    wait_timeout = time.time() + wait_timeout
    while wait_timeout > time.time():
        time.sleep(5)
        operation_result = conn.get_request(
            request_id=promise['requestId'],
            status=True)

        if operation_result['metadata']['status'] == "DONE":
            return
        elif operation_result['metadata']['status'] == "FAILED":
            raise Exception(
                "Request: {0}, requestId: {1} failed to complete:\n{2}".format(
                    msg, six.text_type(promise['requestId']),
                    operation_result['metadata']['message']
                )
            )

    raise Exception(
        'Timed out waiting for asynchronous operation {0} "{1}" to complete.'.format(
            msg, six.text_type(promise['requestId'])
        )
    )
1203526
def action_timeout=(t)
      t = t.to_f
      raise ArgumentError.new('Value must be greater than zero or nil') unless t >= 0
      @action_timeout = t
      @threads.each{|thread|thread.action_timeout = t}
      t
    end