Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jeroenherczeg's avatar

Connection timed out - Session in redis

Hi,

I have a redis server running for queue but also for session management. I have one load balancer and 4 ningx servers. Everything is going great for half a year and now i regularly see this error pop up:

Connection timed out [tcp://10.129.3.113:6379]
releases/20160729085505/vendor/predis/predis/src/Connection/AbstractConnection.php on line 168 

The redis server has plenty of resources left (memory, cpu, ...) and there isn't that much traffic.

Anyone had a similar problem? Or does anyone know how to troubleshoot? I have new relic running and it doesn't look like there is too much traffic or work being done at the moments i get these messages.

Thanks in advance!

0 likes
3 replies
jeroenherczeg's avatar

This is the error trace I got.

Predis\Connection\ConnectionException Connection timed out [tcp://10.129.3.113:6379] 
    vendor/predis/predis/src/Connection/AbstractConnection.php:168 Predis\Connection\AbstractConnection::onConnectionError
    vendor/predis/predis/src/Connection/StreamConnection.php:97 Predis\Connection\StreamConnection::tcpStreamInitializer
    vendor/predis/predis/src/Connection/StreamConnection.php:58 Predis\Connection\StreamConnection::createResource
    vendor/predis/predis/src/Connection/AbstractConnection.php:94 Predis\Connection\AbstractConnection::connect
    vendor/predis/predis/src/Connection/StreamConnection.php:158 Predis\Connection\StreamConnection::connect
    vendor/predis/predis/src/Connection/AbstractConnection.php:193 Predis\Connection\AbstractConnection::getResource
    vendor/predis/predis/src/Connection/StreamConnection.php:184 Predis\Connection\StreamConnection::write
    vendor/predis/predis/src/Connection/StreamConnection.php:290 Predis\Connection\StreamConnection::writeRequest
    vendor/predis/predis/src/Connection/AbstractConnection.php:123 Predis\Connection\AbstractConnection::executeCommand
    vendor/predis/predis/src/Client.php:326 Predis\Client::executeCommand
    vendor/predis/predis/src/Client.php:310 Predis\Client::__call
    vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:54 Predis\Client::get
    vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:54 Illuminate\Cache\RedisStore::get
    vendor/laravel/framework/src/Illuminate/Cache/Repository.php:98 Illuminate\Cache\Repository::get
    vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php:58 Illuminate\Session\CacheBasedSessionHandler::read
    bootstrap/cache/compiled.php:11658 Illuminate\Session\Store::readFromHandler
    bootstrap/cache/compiled.php:11650 Illuminate\Session\Store::loadSession
    bootstrap/cache/compiled.php:11642 Illuminate\Session\Store::start
    bootstrap/cache/compiled.php:11552 Illuminate\Session\Middleware\StartSession::startSession
    bootstrap/cache/compiled.php:11532 Illuminate\Session\Middleware\StartSession::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    bootstrap/cache/compiled.php:12678 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    bootstrap/cache/compiled.php:12615 Illuminate\Cookie\Middleware\EncryptCookies::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    bootstrap/cache/compiled.php:2982 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    [internal] call_user_func
    bootstrap/cache/compiled.php:9582 Illuminate\Pipeline\Pipeline::then
    bootstrap/cache/compiled.php:2254 Illuminate\Foundation\Http\Kernel::sendRequestThroughRouter
    bootstrap/cache/compiled.php:2237 Illuminate\Foundation\Http\Kernel::handle
    public/index.php:54 [main]
marcus_sugarcoated's avatar

Hi.

Did you ever figure this out? I'm having the same issues where I get connection timeouts with a similar setup to yours.

ptidev's avatar

I have the same issue as well. Only started happening recently with no changes related to how we use Redis.

Please or to participate in this conversation.