Shutdown function.

If no request is handled at this point, show a 501 or 404.
325059
final public function shutdown() {
		if ($this->request_handled)
			return;
		$code = 501;
		if (in_array($this->request_method, $this->method_collection))
			$code = 404;
		self::$logger->info(sprintf(
			"Router: shutdown %s in %s '%s'.",
			$code, $this->request_method, $this->request_path));
		$this->abort($code);
	}
1311180
protected static function request_shutdown() {
        global $CFG;

        // Help apache server if possible.
        $apachereleasemem = false;
        if (function_exists('apache_child_terminate') && function_exists('memory_get_usage') && ini_get_bool('child_terminate')) {
            $limit = (empty($CFG->apachemaxmem) ? 64*1024*1024 : $CFG->apachemaxmem); // 64MB default.
            if (memory_get_usage() > get_real_size($limit)) {
                $apachereleasemem = $limit;
                @apache_child_terminate();
            }
        }

        // Deal with perf logging.
        if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {
            if ($apachereleasemem) {
                error_log('Mem usage over '.$apachereleasemem.': marking Apache child for reaping.');
            }
            if (defined('MDL_PERFTOLOG')) {
                $perf = get_performance_info();
                error_log("PERF: " . $perf['txt']);
            }
            if (defined('MDL_PERFINC')) {
                $inc = get_included_files();
                $ts  = 0;
                foreach ($inc as $f) {
                    if (preg_match(':^/:', $f)) {
                        $fs = filesize($f);
                        $ts += $fs;
                        $hfs = display_size($fs);
                        error_log(substr($f, strlen($CFG->dirroot)) . " size: $fs ($hfs)", null, null, 0);
                    } else {
                        error_log($f , null, null, 0);
                    }
                }
                if ($ts > 0 ) {
                    $hts = display_size($ts);
                    error_log("Total size of files included: $ts ($hts)");
                }
            }
        }
    }
102992
public static function handlerShutdown()
    {
        $error = error_get_last();
        if($error !== NULL) {
            self::handlerError($error['type'], '[SHUTDOWN] ' . $error['message'], $error['file'], $error['line']);
        }
    }
429706
def shutdown(opts):
    '''
    
    '''
    log.debug('dummy proxy shutdown() called...')
    DETAILS = _load_state()
    if 'filename' in DETAILS:
        os.unlink(DETAILS['filename'])
526827
public function _shutdown()
	{
		if ($this->_registered && $error = error_get_last())
		{
			try
			{
				// clear the output buffer if we can
				if(ob_get_level()>=1) ob_end_clean();

				// build an error exception
				if (isset($error['type']) && in_array($error['type'],
					array(E_ERROR, E_PARSE, E_COMPILE_ERROR)))
				{
					$this->_handleError(
						$error['type'],
						$error['message'],
						$error['file'],
						$error['line']
						);
				}
			}
			catch(Exception $e)
			{
			}
		}
	}
107326
def shutdown(self):
        """"""
        # Return early if this server has already exited.
        if not process.proc_alive(self.proc):
            return
        logger.info("Attempting to connect to %s", self.hostname)
        client = self.connection
        # Attempt the shutdown command twice, the first attempt might fail due
        # to an election.
        attempts = 2
        for i in range(attempts):
            logger.info("Attempting to send shutdown command to %s",
                        self.hostname)
            try:
                client.admin.command("shutdown", force=True)
            except ConnectionFailure:
                # A shutdown succeeds by closing the connection but a
                # connection error does not necessarily mean that the shutdown
                # has succeeded.
                pass
            # Wait for the server to exit otherwise rerun the shutdown command.
            try:
                return process.wait_mprocess(self.proc, 5)
            except TimeoutError as exc:
                logger.info("Timed out waiting on process: %s", exc)
                continue
        raise ServersError("Server %s failed to shutdown after %s attempts" %
                           (self.hostname, attempts))
1165786
public static function shutdown()
    {
        $last_error = error_get_last();

        if (!is_null($last_error) && $last_error['type'] === E_ERROR) {
            $code = $last_error['type'];
            $message = $last_error['message'];
            $file = $last_error['file'];
            $line = $last_error['line'];

            try {
                // Log the error message
                if (self::$_Log instanceof Log) {
                    self::$_Log->pushToLog(sprintf(
                        '%s %s: %s%s%s',
                        __CLASS__,
                        $code,
                        $message,
                        ($line ? " on line $line" : null),
                        ($file ? " of file $file" : null)
                    ), $code, true);
                }

                ob_clean();

                // Display the error message
                echo self::renderHtml(
                    'fatalerror.fatal',
                    'Fatal Error',
                    $message,
                    $file,
                    $line
                );
            } catch (Exception $e) {
                echo "<pre>";
                echo 'A severe error occurred whilst trying to handle an exception, check the Symphony log for more details' . PHP_EOL;
                echo $e->getMessage() . ' on ' . $e->getLine() . ' of file ' . $e->getFile() . PHP_EOL;
            }
        }
    }
836026
function(res, text, httpStatus) {
		processLogger.log('fatal/request', text);
		apiUtils.errorResponse(res, text, httpStatus || 404);
	}
1110735
public function shutdown()
    {

        // check if there was a fatal error caused shutdown
        if ($lastError = error_get_last()) {
            // initialize error type and message
            $type = 0;
            $message = '';
            // extract the last error values
            extract($lastError);
            // query whether we've a fatal/user error
            if ($type === E_ERROR || $type === E_USER_ERROR) {
                LoggerUtils::log(LogLevel::CRITICAL, $message);
            }
        }
    }
690048
def shutdown(self):
        """"""
        for ware in self.middleware:
            ware.preshutdown()
            self._shutdown()
            ware.postshutdown()
789899
def handle_request(self, request, **resources):
        
        if not request.method in self._meta.callmap.keys():
            raise HttpError(
                'Unknown or unsupported method \'%s\'' % request.method,
                status=status.HTTP_501_NOT_IMPLEMENTED)

        # Get the appropriate create/read/update/delete function
        view = getattr(self, self._meta.callmap[request.method])

        # Get function data
        return view(request, **resources)
774451
async def on_shutdown(app):
    """"""
    global is_shutting_down
    is_shutting_down = True
    for task in app["websockets"]:
        task.cancel()
        try:
            await task
        except asyncio.CancelledError:
            pass
1176577
public function shutdown()
    {
        // check if there was a fatal error caused shutdown
        if ($lastError = error_get_last()) {
            // initialize type + message
            $type = 0;
            $message = '';
            // extract the last error values
            extract($lastError);
            // query whether we've a fatal/user error
            if ($type === E_ERROR || $type === E_USER_ERROR) {
                $this->getInitialContext()->getSystemLogger()->critical($message);
            }
        }
    }
1200607
public static function shutdown_handler()
	{
		$last_error = error_get_last();

		// Only show valid fatal errors
		if ($last_error AND in_array($last_error['type'], static::$fatal_levels))
		{
			$severity = static::$levels[$last_error['type']];
			logger(\Fuel::L_ERROR, $severity.' - '.$last_error['message'].' in '.$last_error['file'].' on line '.$last_error['line']);

			$error = new \ErrorException($last_error['message'], $last_error['type'], 0, $last_error['file'], $last_error['line']);
			if (\Fuel::$env != \Fuel::PRODUCTION)
			{
				static::show_php_error($error);
			}
			else
			{
				static::show_production_error($error);
			}

			exit(1);
		}
	}
206178
public static function shutdownError()
    {
        // Load last error if thrown
        $errfile = 'Unknown file';
        $errstr = 'shutdown';
        $errno = E_CORE_ERROR;
        $errline = 0;

        $error = error_get_last();
        if ($error !== null) {
            $errno = $error['type'];
            $errfile = $error['file'];
            $errline = $error['line'];
            $errstr = $error['message'];

            // Log it!
            $thisType = self::getType($errno);
            Factory::getInstance()->output->set_output('');
            self::errorHandler($errno, $errstr, $errfile, $errline);

            if ($thisType == 'ERROR')
            {
               self::http_error('500'); 
            }
        }
    }
764103
public void stop() {
    if (httpHandler != null) {
      httpHandler.shutdown();
    }
    if (server != null) {
      ServerTools.print("Stopping server...");
      server.stop(5);
      isRunning = false;
      ServerTools.print("Server stopped");
    }
  }
425279
def shutdown():
    
    global handler, transport, protocol
    if handler is not None:
        handler.close()
        transport.close()
        handler = None
        transport = None
        protocol = None