workerman/http-client 经常报错,无规律,找不到原因。

blesswarrior
21-06-02 12:24:19 pid:18027 Error: Call to a member function destroy() on null in /data/wwwroot/project/vendor/workerman/http-client/src/Request.php:453
Stack trace:
#0 /data/wwwroot/project/vendor/workerman/http-client/src/Request.php(431): Workerman\Http\Request->emitError(Object(think\exception\ErrorException))
#1 /data/wwwroot/project/vendor/workerman/http-client/src/Request.php(428): Workerman\Http\Request->handleChunkedData(Object(Workerman\Connection\AsyncTcpConnection), '')
#2 /data/wwwroot/project/vendor/workerman/http-client/src/Request.php(420): Workerman\Http\Request->handleChunkedData(Object(Workerman\Connection\AsyncTcpConnection), '')
#3 /data/wwwroot/project/vendor/workerman/http-client/src/Request.php(349): Workerman\Http\Request->handleChunkedData(Object(Workerman\Connection\AsyncTcpConnection), '233\r\n{"msg":"SU...')
#4 /data/wwwroot/project/vendor/workerman/http-client/src/Request.php(326): Workerman\Http\Request->checkComplete('233\r\n{"msg":"SU...')
#5 /data/wwwroot/project/vendor/workerman/workerman/Connection/TcpConnection.php(660): Workerman\Http\Request->onMessage(Object(Workerman\Connection\AsyncTcpConnection), 'HTTP/1.1 200 \r\n...')
#6 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #246, 2, Resource id #246)
#7 /data/wwwroot/project/vendor/workerman/workerman/Events/Event.php(195): EventBase->loop()
#8 /data/wwwroot/project/vendor/workerman/workerman/Worker.php(2430): Workerman\Events\Event->loop()
#9 /data/wwwroot/project/vendor/workerman/workerman/Worker.php(1554): Workerman\Worker->run()
#10 /data/wwwroot/project/vendor/workerman/workerman/Worker.php(1384): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
#11 /data/wwwroot/project/vendor/workerman/workerman/Worker.php(1358): Workerman\Worker::forkWorkersForLinux()
#12 /data/wwwroot/project/vendor/workerman/workerman/Worker.php(542): Workerman\Worker::forkWorkers()
#13 /data/wwwroot/project/app/workerman/command/Worker.php(65): Workerman\Worker::runAll()
#14 /data/wwwroot/project/vendor/topthink/framework/src/think/console/Command.php(210): app\workerman\command\Worker->execute(Object(think\console\Input), Object(think\console\Output))
#15 /data/wwwroot/project/vendor/topthink/framework/src/think/Console.php(655): think\console\Command->run(Object(think\console\Input), Object(think\console\Output))
#16 /data/wwwroot/project/vendor/topthink/framework/src/think/Console.php(314): think\Console->doRunCommand(Object(app\workerman\command\Worker), Object(think\console\Input), Object(think\console\Output))
#17 /data/wwwroot/project/vendor/topthink/framework/src/think/Console.php(251): think\Console->doRun(Object(think\console\Input), Object(think\console\Output))
#18 /data/wwwroot/project/think(10): think\Console->run()
#19 {main}
2021-06-02 12:24:19 pid:18027 Worker[18027] process terminated
2021-06-02 12:24:19 pid:18015 worker[Webserver:18027] exit with status 64000
2641 1 0
1个回答

latin

改下源码,判断下 是不是null,是null就不执行destroy()

  • blesswarrior 2021-06-02
    public function emitError($e)
    {
        if (!is_null($this->_connection)) {
            $this->_connection->destroy();
        }
        $this->emit('error', $e);
    }

    改完后发现 用status ,显示有很多 connections 连接着没有断开

  • latin 2021-06-02

    不改试下是不是很多连接没断开。对比下。不然你不知道是不是你改的问题。

  • blesswarrior 2021-06-03

    @998:的确没出现这个问题了

年代过于久远,无法发表回答
×
🔝