3

I'm using redis with php (predis at http://github.com/nrk/predis/) and am experiencing frequent timeout. The stack trace shows:

[04-Apr-2010 03:39:50] PHP Fatal error:  Uncaught exception 'Predis_ClientException' with message 'Connection timed out' in redis.php:697
Stack trace:
#0 redis.php(757): Predis_Connection->connect()
#1 redis.php(729): Predis_Connection->getSocket()
#2 redis.php(825): Predis_Connection->writeCommand(Object(Predis_Commands_ListRange))
#3 redis.php(165): Predis_ConnectionCluster->writeCommand(Object(Predis_Commands_ListRange))
#4 redis.php(173): Predis_Client->executeCommandInternal(Object(Predis_ConnectionCluster), Object(Predis_Commands_ListRange))
#5 redis.php(157): Predis_Client->executeCommand(Object(Predis_Commands_ListRange))
#6 [internal function]: Predis_Client->__call('lrange', Array)

This happens consistently and I have no idea why. Anyone has any idea?

j0k
  • 22,600
  • 28
  • 79
  • 90
Patrick
  • 4,815
  • 11
  • 52
  • 55

2 Answers2

11

I think this is because of idle connections are getting closed by default by Redis.

redis.conf

# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0
Alfred
  • 60,935
  • 33
  • 147
  • 186
  • Shouldn't the idle connections be closed after few seconds before it hits the maximum connections allowed? – mixdev Sep 01 '12 at 04:03
  • 0 means the timeout is disabled, and by default it's set to 0... so that shouldn't be the timeout issue, but as stated by @SuneRievers below there is a bug with that functionality. – Matt K Dec 05 '13 at 20:48
0

There is an unconfirmed bug on the Redis Issues List, try updating Redis to the most current version and see if the problem persists.

Sune Rievers
  • 2,676
  • 3
  • 25
  • 29