Magento “Front controller reached 100 router match iterations” error

exceptionmagento

My site is going down once or twice a day when it starts throwing the exception "Front controller reached 100 router match iterations". Once this happens access to the admin and frontend is gone. I am just left with an error page.

This started after upgrading from Magento 1.5.0.1 to 1.5.1.0. If I manually clear the var/cache/ directory I am up and running again.

I have googled the heck out of this one. In the limited search results I have found nothing has helped me with resolving this.

Any insight into why this may be happening and how it could be resolved would be appreciated.

–update———————–

Using the debugging code provided in the helpful answer from, Andrey Tserkus, I was able to determine that the error is caused by some of my routers disappearing.

The normal routers output by the debug code are:
Total 7: admin, standard, cms, amshopby, fishpig_wordpress, seosuite, default

When the error occurs they have changed to:
Total 3: admin, standard, default

When this happens it seems the missing routes causes the code to iterate to 100 for every page request. I will investigate this condition further.

Best Answer

UPDATE 2: I have some further changes which should help prevent a different cause of the 100 router match iterations

https://github.com/convenient/magento-ce-ee-config-corruption-bug#update-2-further-improvements

====================================================================

UPDATE: MAGENTO HAVE USED MY ANSWER AS A PATCH

https://github.com/convenient/magento-ce-ee-config-corruption-bug#update-good-news-a-patch-from-magento

====================================================================

I've recently spent quite some time looking into this bug. I've written up my full findings, explanation and replication here.

https://github.com/convenient/magento-ce-ee-config-corruption-bug

However, for the short answer. This appears to be a Magento bug which can be corrected by overriding Mage_Core_Model_Config::init with the following:

 public function init($options=array())
 {
     $this->setCacheChecksum(null);
     $this->_cacheLoadedSections = array();
     $this->setOptions($options);
     $this->loadBase();

     $cacheLoad = $this->loadModulesCache();
     if ($cacheLoad) {
         return $this;
     }
     //100 Router Fix Start
     $this->_useCache = false;
     //100 Router Fix End
     $this->loadModules();
     $this->loadDb();
     $this->saveCache();
     return $this;
 }

EDIT: Updated to test on vanilla 1.5

I just ran the replication script on a vanilla install of 1.5. Which had all caches except for the CONFIG cache disabled.

It did not produce the 100 router error as it does on 1.13, but it did break the website and all the homepage displayed was a white screen.

The cause was that when we were looking for a controller and action we were matched with Mage_Core_IndexController::indexAction instead of Mage_Cms_IndexController::indexAction.

class Mage_Core_IndexController extends Mage_Core_Controller_Front_Action {

    function indexAction()
    {

    }
}

Mage_Core_IndexController::indexAction is an empty function, and explains the white page perfectly.

I can no longer replicate this error when placing _useCache = false into Mage_Core_Model_Config.

I believe that maybe your Magento sites unique configuration might cause it to completely fail to match a controller, as opposed to falling back to this Mage_Core_IndexController action?

Related Topic