Dec 1, 2013
kalpesh

Magento Redis read error on connection

Magento read error on connection when using Redis. If you are using Redis as cache in Magento and read timeout is not specified, you may get this error. Below is how it looks in the error report.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
read error on connection

Trace:
#1 lib/Mage/Cache/Backend/Redis.php(210): Credis_Client->hGet('zc:k:0cd_FPC_DE...', 'd')
#2 lib/Zend/Cache/Core.php(303): Mage_Cache_Backend_Redis->load('0cd_FPC_DESIGN_...', false)
#3 lib/Varien/Cache/Core.php(158): Zend_Cache_Core->load('FPC_DESIGN_EXCE...', false, false)
#4 app/code/core/Mage/Core/Model/Cache.php(379): Varien_Cache_Core->load('FPC_DESIGN_EXCE...')
#5 app/code/core/Enterprise/PageCache/Model/Processor.php(185): Mage_Core_Model_Cache->load('FPC_DESIGN_EXCE...')
#6 app/code/core/Enterprise/PageCache/Model/Processor.php(146): Enterprise_PageCache_Model_Processor->_getDesignPackage()
#7 app/code/core/Enterprise/PageCache/Model/Processor.php(108): Enterprise_PageCache_Model_Processor->_createRequestIds()
#8 app/code/core/Mage/Core/Model/Cache.php(703): Enterprise_PageCache_Model_Processor->__construct()
#9 app/code/core/Mage/Core/Model/Cache.php(685): Mage_Core_Model_Cache->_getProcessor('Enterprise_Page...')
#10 app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Model_Cache->processRequest()
#11 app/Mage.php(683): Mage_Core_Model_App->run(Array)
#12 /var/www/source/index.php(87): Mage::run('', 'store')

The solution (atleast for us) was to add a read_timeout config option in app/etc/local.xml where you have configured Redis cache for Magento.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<cache>
        <backend>Mage_Cache_Backend_Redis</backend>
        <backend_options>
                <server>127.0.0.1</server>
                <port>6379</port>
                <persistent></persistent>
                <database>0</database>
                <password></password>
                <force_standalone>0</force_standalone>
                <connect_retries>1</connect_retries>
                <read_timeout>10</read_timeout><!--add this-->
                <lifetimelimit>57600</lifetimelimit>
                <compress_data>0</compress_data>
        </backend_options>
</cache>

HTH!

Leave a comment

 

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!

Certifications