国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

偶爾出現(xiàn)Call to undefined method getRealIp()

沉夢

問題描述

偶爾會出現(xiàn)Call to undefined method Workerman\Protocols\Http\Request::getRealIp() ,在剛啟動時(shí)概率很高,要多刷新幾次后網(wǎng)站訪問才會正常,我搜索了類似的帖子有一個(gè),按照老大提供的方法改了還是會出現(xiàn)
如下類似帖子
http://m.wtbis.cn/q/13952

我在Http.php添加onMessage回調(diào)打印

public function onMessage($connection, $request)
    {
        var_dump(get_class($request));
        parent::onMessage($connection, $request);
    }

出現(xiàn)報(bào)錯(cuò)時(shí)的類是Workerman\Protocols\Http\Request
截圖

訪問正常的類是support\Request
截圖

我發(fā)現(xiàn)訪問當(dāng)出現(xiàn)報(bào)錯(cuò)的頁面時(shí),換一個(gè)url頁面訪問它又正常了,返回之前的報(bào)錯(cuò)頁面的刷新很多次還是會報(bào)錯(cuò),

程序代碼

config/process.php

<?php
use app\process\Http;
use support\Log;
use support\Request;

global $argv;

$mode = config('app.mode', 'main');

// $server_name = config('main.server_name', 'main');
$server_name =  '-' . $mode;

return [
    // http服務(wù)配置
    'webman' . $server_name   => [
        'handler'     => Http::class,
        'listen'      => 'http://127.0.0.1:' . ($mode == 'h5' ? '9797' : '8787'),
        'count'       => $mode == 'h5' ? cpu_count() * 3 : cpu_count() * 2,
        'user'        => 'www',
        'group'       => 'www',
        'reusePort'   => false,
        // 'eventLoop'   => '',
        'eventLoop'   => \Workerman\Events\Swoole::class,
        'context'     => [],
        'constructor' => [
            'requestClass' => Request::class,
            'logger'       => Log::channel('default'),
            'appPath'      => app_path(),
            'publicPath'   => public_path(),
        ],
    ],
    // 系統(tǒng)定時(shí)任務(wù)
    'cmyiot.timer' . $server_name   => [
        'handler'     => app\process\SysCron::class,
        'count'       => $mode == 'h5' ? 1 : cpu_count(),
    ],
    // 推送定時(shí)任務(wù)
    'cmyiot.task' . $server_name   => [
        'handler'     => app\process\SysTask::class,
        'count'       => $mode == 'h5' ? 1 : ceil(cpu_count() / 2),
    ],
    // File update detection and automatic reload
    'monitor' => [
        'handler'     => app\process\Monitor::class,
        'reloadable'  => false,
        'constructor' => [
            // Monitor these directories
            'monitorDir'        => array_merge([
                app_path(),
                config_path(),
                base_path() . '/process',
                base_path() . '/support',
                base_path() . '/resource',
                base_path() . '/.env',
            ], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
            // Files with these suffixes will be monitored
            'monitorExtensions' => [
                'php',
                'html',
                'htm',
                'env',
            ],
            'options'           => [
                'enable_file_monitor'   => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/',
                'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
            ],
        ],
    ],
];

報(bào)錯(cuò)信息

Error: Call to undefined method Workerman\Protocols\Http\Request::getRealIp() in /www/wwwroot/iot.xxx.cn/vendor/workerman/webman-framework/src/Exception/ExceptionHandler.php:68 Stack trace: #0 /www/wwwroot/iot.xxx.cn/app/common/exception/Http.php(44): Webman\Exception\ExceptionHandler->report() #1 /www/wwwroot/iot.xxx.cn/vendor/workerman/webman-framework/src/App.php(283): app\common\exception\Http->report() #2 /www/wwwroot/iot.xxx.cn/vendor/workerman/webman-framework/src/App.php(357): Webman\App::exceptionResponse() #3 /www/wwwroot/iot.xxx.cn/vendor/workerman/webman-framework/src/App.php(671): Webman\App::Webman\{closure}() #4 /www/wwwroot/iot.xxx.cn/vendor/workerman/webman-framework/src/App.php(159): Webman\App::findRoute() #5 /www/wwwroot/iot.xxx.cn/vendor/workerman/workerman/src/Connection/TcpConnection.php(676): Webman\App->onMessage() #6 /www/wwwroot/iot.xxx.cn/vendor/workerman/workerman/src/Events/Swoole.php(288): Workerman\Connection\TcpConnection->baseRead() #7 [internal function]: Workerman\Events\Swoole->Workerman\Events\{closure}() #8 {main}

截圖報(bào)錯(cuò)信息里報(bào)錯(cuò)文件相關(guān)代碼

截圖

操作系統(tǒng)及workerman/webman等框架組件具體版本

操作系統(tǒng):CentOS 7.9.2009 x86_64(Py3.7.9)
webman版本:v2.1.2
workerman版本:v5.1.1
swoole版本:v5.1.4
Nginx版本: 1.26.1

截圖

413 1 0
1個(gè)回答

Tinywan
  • 沉夢 2025-04-10

    沒用,你看我描述不仔細(xì)

  • 沉夢 2025-04-10

    我這個(gè)是開了協(xié)程,大概率跟協(xié)程有關(guān)

  • Tinywan 2025-04-10

    那就沒遇到過

??