Fix PHP Fatal Error: Uncaught Exception CredisException in Magento 1.9

magento-1.9PHPredis

We are getting these errors from time to time, and we have no idea what causing them.

We are using:

Magento 1.9.3.3
PHP 5.6.30
Redis 3.2.9

Error in logs

PHP Fatal error:  Uncaught exception 'CredisException' with message
'Read operation timed out.' in /multistore/lib/Credis/Client.php:1042
Stack trace:
#0 /multistore/lib/Credis/Client.php(825): Credis_Client->read_reply('select')
#1 /multistore/lib/Credis/Client.php(599): Credis_Client->__call('select', Array)
#2 /multistore/lib/Cm/Cache/Backend/Redis.php(135): Credis_Client->select(2)
#3 /multistore/lib/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array)
#4 /multistore/lib/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)
#5 /multistore/app/code/core/Mage/Core/Model/Cache.php(137): Zend_Cache::factory('Varien_Cache_Co...', 'Cm_Cache_Backen...', Array, Array, true, true, true)
#6 /multistore in /multistore/lib/Credis/Client.php on line 1042

Best Answer

There are a few things you could try out, changing the timeout for example.

You can find the settings in: /etc/redis/redis.conf

More info here: Magento Redis Session sudden "'CredisException' with message 'read error on > connection'"