Magento “Front controller reached 100 router match iterations” error

后端 未结 10 2438
失恋的感觉
失恋的感觉 2020-12-05 04:54

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 adm

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 05:22

    The error message is too general to try to solve this problem. I suggest you to hire some freelancer Magento web-developer to look to the source of the problem on your actual site. It cannot be solved theoretically.

    As seen from the message, the problem occurs because your routers are making circular references for dispatching requests. One of them matches request, but doesn't dispatch and pushes it to redispatch again. Or no router matches request at all.

    You can get more information by going to Magento Core file app/code/core/Mage/Core/Controller/Varien/Front.php, find there lines

    while (!$request->isDispatched() && $i++<100) {
        foreach ($this->_routers as $router) {
            if ($router->match($this->getRequest())) {
                break;
            }
        }
    }
    

    and replace them with

    Mage::log('----Matching routers------------------------------');
    Mage::log('Total ' . count($this->_routers) . ': ' . implode(', ', array_keys($this->_routers)));
    while (!$request->isDispatched() && $i++<100) {
        Mage::log('- Iteration ' . $i);
        $requestData = array(
            'path_info' => $request->getPathInfo(),
            'module' => $request->getModuleName(),
            'action' => $request->getActionName(),
            'controller' => $request->getControllerName(),
            'controller_module' => $request->getControllerModule(),
            'route' => $request->getRouteName()
        );
    
        $st = '';
        foreach ($requestData as $key => $val) {
            $st .= "[{$key}={$val}]";
        }
        Mage::log('Request: ' . $st);
        foreach ($this->_routers as $name => $router) {
            if ($router->match($this->getRequest())) {
                Mage::log('Matched by "' . $name . '" router, class ' . get_class($router));
                break;
            }
        }
    }
    

    After that wait for site to produce the error, open var/log/system.log and see there debugging information about what is going on inside your system. It will help to see much more better, what router breaks the system.

提交回复
热议问题