Cm_Cache_Backend_Redis icon indicating copy to clipboard operation
Cm_Cache_Backend_Redis copied to clipboard

Error cleaning cache by mode matchingAnyTag

Open norgeindian opened this issue 3 years ago • 11 comments

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?

norgeindian avatar Apr 07 '21 09:04 norgeindian

No idea, can you provide a backtrace?

What was the version you were previously using?

@nemphys have you experienced this before?

colinmollenhour avatar Apr 07 '21 21:04 colinmollenhour

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.

nemphys avatar Apr 08 '21 08:04 nemphys

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?

norgeindian avatar Apr 08 '21 08:04 norgeindian

Your stack trace is missing the first frame..

Do you have lua mode enabled or no?

colinmollenhour avatar Apr 08 '21 16:04 colinmollenhour

@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?

norgeindian avatar Apr 12 '21 08:04 norgeindian

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

colinmollenhour avatar Apr 13 '21 01:04 colinmollenhour

@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.

norgeindian avatar Apr 14 '21 13:04 norgeindian

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.

mlaurense avatar Apr 22 '21 08:04 mlaurense

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

snufpunk avatar Jun 09 '21 10:06 snufpunk

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

ioweb-gr avatar Jun 16 '22 09:06 ioweb-gr

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..

colinmollenhour avatar Jun 21 '22 01:06 colinmollenhour

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.

luigifab avatar Mar 09 '23 13:03 luigifab

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?

colinmollenhour avatar Mar 09 '23 18:03 colinmollenhour

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

luigifab avatar Mar 09 '23 19:03 luigifab

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

luigifab avatar Apr 05 '23 09:04 luigifab

Fixed with <use_lua>1</use_lua>.

luigifab avatar May 30 '23 07:05 luigifab

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).

fballiano avatar Oct 25 '23 08:10 fballiano

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

colinmollenhour avatar Oct 25 '23 17:10 colinmollenhour