php – Redis“从服务器读取行时出错.”在Laravel 5.6升级之后
作者:互联网
在今天升级到Laravel 5.6后,我遇到了很多Redis错误,并说明:
Error while reading line from the server. [tcp://redis.localhost:6379] {"exception":"[object] (Predis\\Connection\\ConnectionException(code: 0): Error while reading line from the server. [tcp://redis.localhost:6379] at /var/www/manage.localhost/vendor/predis/predis/src/Connection/AbstractConnection.php:155)
应用程序堆栈包括:
> Laravel 5.6
> Horizon 1.0.6
>回声1.3.2
> Laravel Echo Server 1.3.6
一切都在5.5上顺利运行,我发现的所有文档似乎都没有解决这个问题.除了一些Cache使用之外,在应用程序中没有通过外观或服务容器外的Redis使用.
还有其他人遇到过这种情况吗?我已经三次检查了升级指南以及GitHub发行说明,并且没有任何内容被删除是可疑的.基于堆栈跟踪,它似乎与Horizon相关.
全栈跟踪
#0 /var/www/manage.localhost/vendor/predis/predis/src/Connection/StreamConnection.php(314): Predis\\Connection\\AbstractConnection->onConnectionError('Error while rea...')
#1 /var/www/manage.localhost/vendor/predis/predis/src/Connection/AbstractConnection.php(120): Predis\\Connection\\StreamConnection->read()
#2 /var/www/manage.localhost/vendor/predis/predis/src/Connection/AbstractConnection.php(112): Predis\\Connection\\AbstractConnection->readResponse(Object(Predis\\Command\\ListPopFirstBlocking))
#3 /var/www/manage.localhost/vendor/predis/predis/src/Client.php(331): Predis\\Connection\\AbstractConnection->executeCommand(Object(Predis\\Command\\ListPopFirstBlocking))
#4 /var/www/manage.localhost/vendor/predis/predis/src/Client.php(314): Predis\\Client->executeCommand(Object(Predis\\Command\\ListPopFirstBlocking))
#5 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(96): Predis\\Client->__call('blpop', Array)
#6 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(108): Illuminate\\Redis\\Connections\\Connection->command('blpop', Array)
#7 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php(230): Illuminate\\Redis\\Connections\\Connection->__call('blpop', Array)
#8 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php(213): Illuminate\\Queue\\RedisQueue->blockingPop('queues:events')
#9 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php(165): Illuminate\\Queue\\RedisQueue->retrieveNextJob('queues:events')
#10 /var/www/manage.localhost/vendor/laravel/horizon/src/RedisQueue.php(92): Illuminate\\Queue\\RedisQueue->pop('events')
#11 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(246): Laravel\\Horizon\\RedisQueue->pop('events')
#12 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(107): Illuminate\\Queue\\Worker->getNextJob(Object(Laravel\\Horizon\\RedisQueue), 'events')
#13 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\\Queue\\Worker->daemon('website_manager', 'events', Object(Illuminate\\Queue\\WorkerOptions))
#14 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\\Queue\\Console\\WorkCommand->runWorker('website_manager', 'events')
#15 [internal function]: Illuminate\\Queue\\Console\\WorkCommand->handle()
#16 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#17 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#18 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#19 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#20 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array)
#21 /var/www/manage.localhost/vendor/symfony/console/Command/Command.php(252): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#22 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#23 /var/www/manage.localhost/vendor/symfony/console/Application.php(865): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#24 /var/www/manage.localhost/vendor/symfony/console/Application.php(241): Symfony\\Component\\Console\\Application->doRunCommand(Object(Laravel\\Horizon\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#25 /var/www/manage.localhost/vendor/symfony/console/Application.php(143): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#26 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#27 /var/www/manage.localhost/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#28 /var/www/manage.localhost/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#29 {main}
解决方法:
在redis.default键下的config / database.php文件中添加此行(或者您拥有的连接名称)为我解决了这个问题:
'read_write_timeout' => 0,
标签:php,redis,laravel,laravel-horizon 来源: https://codeday.me/bug/20190701/1347721.html