colinmollenhour / Cm_Cache_Backend_Redis

A Zend_Cache backend for Redis with full support for tags (works great with Magento)
Other
390 stars 142 forks source link

Error cleaning cache by mode matchingAnyTag #164

Closed norgeindian closed 10 months ago

norgeindian commented 3 years ago

Since we updated to the newest version of this module, we get the following error every time when flushing the cache:

Error cleaning cache by mode matchingAnyTag: A pipeline is already in use and only one pipeline is supported

Any ideas what might go wrong here?

colinmollenhour commented 3 years ago

No idea, can you provide a backtrace?

What was the version you were previously using?

@nemphys have you experienced this before?

nemphys commented 3 years ago

No idea either, I have been running the latest fix in production since the day it was merged and have not seen any logged errors.

norgeindian commented 3 years ago

This is the call stack:

#1 /var/www/share/www.shop-url.de/live/shop/lib/Zend/Cache/Core.php(465): Cm_Cache_Backend_Redis->clean('matchingAnyTag', Array)
#2 /var/www/share/www.shop-url.de/live/shop/lib/Varien/Cache/Core.php(211): Zend_Cache_Core->clean('matchingAnyTag', Array)
#3 /var/www/share/www.shop-url.de/live/.modman/Lesti_Fpc/app/code/community/Lesti/Fpc/Model/Fpc.php(149): Varien_Cache_Core->clean('matchingAnyTag', Array)
#4 /var/www/share/www.shop-url.de/live/.modman/Lesti_Fpc/app/code/community/Lesti/Fpc/Model/Observer/Clean.php(28): Lesti_Fpc_Model_Fpc->clean()
#5 /var/www/share/www.shop-url.de/live/shop/app/code/core/Mage/Core/Model/App.php(1374): Lesti_Fpc_Model_Observer_Clean->adminhtmlCacheFlushAll(Object(Varien_Event_Observer))
#6 /var/www/share/www.shop-url.de/live/shop/app/code/core/Mage/Core/Model/App.php(1353): Mage_Core_Model_App->_callObserverMethod(Object(Lesti_Fpc_Model_Observer_Clean), 'adminhtmlCacheF...', Object(Varien_Event_$
#7 /var/www/share/www.shop-url.de/live/shop/app/Mage.php(451): Mage_Core_Model_App->dispatchEvent('adminhtml_cache...', Array)
#8 /var/www/share/www.shop-url.de/live/shop/app/code/core/Mage/Adminhtml/controllers/CacheController.php(56): Mage::dispatchEvent('adminhtml_cache...')
#9 /var/www/share/www.shop-url.de/live/shop/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_CacheController->flushAllAction()
#10 /var/www/share/www.shop-url.de/live/shop/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('flushAll')
#11 /var/www/share/www.shop-url.de/live/shop/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /var/www/share/www.shop-url.de/live/shop/app/code/core/Mage/Core/Model/App.php(381): Mage_Core_Controller_Varien_Front->dispatch()
#13 /var/www/share/www.shop-url.de/live/shop/app/Mage.php(686): Mage_Core_Model_App->run(Array)
#14 /var/www/share/www.shop-url.de/live/shop/index.php(83): Mage::run('', 'store')
#15 {main}";s:3:"url";s:70:"/index.php/admin/cache/flushAll/key/d70f3660b0ee7acd5c282a39f0ad0330/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}

Last time we updated was December 2018, so I assume version 1.10.6. And like I wrote, there everything worked fine. Might it be that I have to adapt the config somehow since then? Interestingly no errors happen when I run cache:clean, only when running cache:flush. Do you have any idea what I could check?

colinmollenhour commented 3 years ago

Your stack trace is missing the first frame..

Do you have lua mode enabled or no?

norgeindian commented 3 years ago

@colinmollenhour , sorry, here is the first line:

a:5:{i:0;s:109:"Error cleaning cache by mode matchingAnyTag: A pipeline is already in use and only one pipeline is supported.";i:1;s:2324:"#0 /var/www/share/www.shop-url.de/live/.modman/Cm_CacheBackendRedis/Cm/Cache/Backend/Redis.php(999): Zend_Cache::throwException('Error cleaning ...', Object(CredisException))

Any idea?

colinmollenhour commented 3 years ago

Still not really any idea. But what about lua mode, are you using it? Have you tried it both ways?

norgeindian commented 3 years ago

@colinmollenhour , tried both ways, still the same error. Strange.... I will try to debug this further and will let you know as soon as I found out what is going wrong here.

mlaurense commented 3 years ago

I experienced the same, although setting use_lua to 1 seemed to have fixed this. I will keep a close watch to see if this issue returns.

snufpunk commented 3 years ago

We had the same issue, does not recurr after setting use_lua to 1.

ioweb-gr commented 2 years ago

I had the same issue

a:5:{i:0;s:64:"A pipeline is already in use and only one pipeline is supported.";i:1;s:2960:"#0 /public_html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(626): Credis_Client->__call('pipeline', Array)
#1 /public_html/lib/Zend/Cache/Core.php(390): Cm_Cache_Backend_Redis->save('a:4:{s:2:"id";a...', '4af_DB_PDO_MYSQ...', Array, false)
#2 /public_html/lib/Varien/Cache/Core.php(145): Zend_Cache_Core->save('a:4:{s:2:"id";a...', '4af_DB_PDO_MYSQ...', Array, false, 8)
#3 /public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1593): Varien_Cache_Core->save('a:4:{s:2:"id";a...', 'DB_PDO_MYSQL_DD...', Array)
#4 /public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1723): Varien_Db_Adapter_Pdo_Mysql->saveDdlCache('plumbase_produc...', 1, 'a:4:{s:2:"id";a...')
#5 /public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(402): Varien_Db_Adapter_Pdo_Mysql->describeTable('plumbase_produc...')
#6 /public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(378): Mage_Core_Model_Resource_Db_Abstract->_getLoadSelect('signature', '095a1b43effec73...', Object(Plumrocket_Base_Model_Product))
#7 /public_html/app/code/core/Mage/Core/Model/Abstract.php(237): Mage_Core_Model_Resource_Db_Abstract->load(Object(Plumrocket_Base_Model_Product), '095a1b43effec73...', 'signature')
#8 /public_html/app/code/community/Plumrocket/Base/Model/Product.php(22): Mage_Core_Model_Abstract->load('095a1b43effec73...', 'signature')
#9 /public_html/app/code/community/Plumrocket/Base/Model/Product.php(22): Plumrocket_Base_Model_Product->load('Base')
#10 /public_html/app/code/core/Mage/Core/Model/App.php(1410): Plumrocket_Base_Model_Product->reindex(Object(Varien_Event_Observer))
#11 /public_html/app/code/core/Mage/Core/Model/App.php(1389): Mage_Core_Model_App->_callObserverMethod(Object(Plumrocket_Base_Model_Product), 'reindex', Object(Varien_Event_Observer))
#12 /public_html/app/Mage.php(502): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#13 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(571): Mage::dispatchEvent('controller_acti...', Array)
#14 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(441): Mage_Core_Controller_Varien_Action->postDispatch()
#15 /public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(262): Mage_Core_Controller_Varien_Action->dispatch('save')
#16 /public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(192): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /public_html/app/code/core/Mage/Core/Model/App.php(381): Mage_Core_Controller_Varien_Front->dispatch()
#18 /public_html/app/Mage.php(737): Mage_Core_Model_App->run(Array)
#19 /public_html/index.php(83): Mage::run('', 'store')

I'm going to try use_lua as well and report back

colinmollenhour commented 2 years ago

I don't think there is even a good reason to not remove the non-lua mode, since the version of Redis that didn't support it is long gone..

luigifab commented 1 year ago

Since I have updated to OpenMage 20.1.0-rc1 (colinmollenhour/cache-backend-redis 1.16 installed by composer), I have, rarely, the same error (Error cleaning cache by mode matchingAnyTag: A pipeline is already in use and only one pipeline is supported) when we try to flush cache with left button of OM backend:

image left button: flushSystem right button: flushAll

    public function flushSystemAction()
    {
        Mage::app()->cleanCache();
        Mage::dispatchEvent('adminhtml_cache_flush_system');
        $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The OpenMage cache ..."));
        $this->_redirect('*/*');
    }

The Sentry stack trace: image

We are using Redis server v=5.0.3. This bug started when I updated OM. Last time, I tried to flush cache with right button, then left button, and it temporary fix the problem. But...

I found that: https://magento.stackexchange.com/a/95386/101197 But not sure what to think.

colinmollenhour commented 1 year ago

Probably there is a different error being thrown and the pipeline management is not resetting the pipeline or something along those lines.. Using LUA mode makes it really simple from teh PHP side though which is why this fixes it in most cases.. Just to confirm, do you have LUA mode enabled?

luigifab commented 1 year ago

If it's <use_lua>0</use_lua>, so no disabled.

luigifab commented 1 year ago

I updated to Redis 6.0.16, same, but still rarely.

luigifab commented 1 year ago

Fixed with <use_lua>1</use_lua>.

fballiano commented 10 months ago

I found this issue because I'm also facing this same problem on redis 5.0.7, seems to be fixed enabling lua on all 3 redis connections (openmage cache, openmage full page cache, sessions).

colinmollenhour commented 10 months ago

Sorry, I should have done this long ago... I kinda thought I already had.. Anyway, I just made lua enabled by default. I'm not really interested in fixing the non-lua mode, it may not be possible due to inherent race conditions. I may even remove it..

https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/releases/tag/1.17.0