Closed andriihorpenko closed 6 years ago
Seems to be a pure connectivity problem? Problem connection to redis? Is redis on the same or remote (Timeout to redis)?
I haven't experienced any problems with connection(while using redis-cli?). Redis is on the same server and running along with my site.
Is Redis running out of memory or available connections?
https://github.com/laravel/horizon/issues/152#issuecomment-331877396 https://github.com/nrk/predis/issues/33
By the way, my server has 128 gigs of RAM. How can I measure Redis memory consumption? Setting maxmemory to 0?
Max memory is default and set to 0.
Always set maxmemory to a defined limit to make sure you get some errors reported instead of some silent fails. See Check out https://redis.io/topics/admin .
Also, I suggest you use phpredis (https://github.com/phpredis/phpredis) instead of predis. This should result in a better performing app since phpredis is a PHP extension and predis is native PHP. If you're on Ubuntu or Debian, I can recommend Ondrej Sury's repository for that: https://deb.sury.org/ .
@emielmolenaar even better, use phpiredis
(note the i
) which is an extension that predis supports as a backend. Can be turned on by adding the following to database.php
config under redis
'options' => [
'connections' => [
'tcp' => 'Predis\Connection\PhpiredisStreamConnection',
'unix' => 'Predis\Connection\PhpiredisSocketConnection',
],
],
Thanks @francislavoie ! Will check it out.
I got the resolution to the problem. So, there is a limit to ports that a application server can connect to a particular application on another machine. These ports were getting exhausted. We increased the limit and the problem got resolved.
How we got to know about this problem ? In php, we were getting "Cannot assign requested address" error while creating a socket (error code 99).
How and where do we have to change that limit? Thanks in advance!
Old stuff, closing.
Leaving a breadcrumb here: $client->hgetall($uri);
was failing in PHP with the caught exception "Error while writing bytes to the server." But logging into redis directly and running HGETALL <path>
returned the expected result, and that somehow kicked PHP into gear to work.
I'm here using PHP 8.2 and Laravel 10 and this issue still persist :(
I'm here using PHP 8.2 and Laravel 10 and this issue still persist :(
Currently battling with this same error on same Laravel 10 / Horizon setup and haven't been successful with the fix
I'm here using PHP 8.2 and Laravel 10 and this issue still persist :(
Currently battling with this same error on same Laravel 10 / Horizon setup and haven't been successful with the fix
After almost 1 year struggling with this, I just gave up and moved my jobs/queues to serverless applications with C#, Go and Rust 👍
I am experiencing some errors while interacting with Redis in Laravel. Every time I call Redis functions (e.x. zrange), Laravel logs this error
[2018-04-07 20:02:46] local.ERROR: Error while writing bytes to the server. [tcp://127.0.0.1:6379] {"exception":"[object] (Predis\\Connection\\ConnectionException(code: 0): Error while writing bytes to the server. [tcp://127.0.0.1:6379] at /var/www/html/vendor/predis/predis/src/Connection/AbstractConnection.php:155)
I can't fix this. Help me.. P.S. Everything is up-to-date(I mean laravel, horizon and redis).