Search code examples
magentomagento-1.5

Magento 1.5. Uncaught exception 'Mage_Core_Model_Session_Exception'


I get the occasional error below on Magento 1.5.0.1, when it occurs, customers report that they are unable to add items to cart. On clearing their browser cache and hence a new session, there are no issues.

Any ideas on what is happening and how to fix?

[17-Aug-2012 04:37:09 UTC] PHP Fatal error:  Uncaught exception 'Mage_Core_Model_Session_Exception' in        /home/magento/public_html/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:341
Stack trace:
       #0 /home/magento/public_html/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php(166): Mage_Core_Model_Session_Abstract_Varien->validate()
       #1 /home/magento/public_html/app/code/core/Mage/Core/Model/Session/Abstract.php(84): Mage_Core_Model_Session_Abstract_Varien->init('checkout', NULL)
       #2 /home/magento/public_html/app/code/core/Mage/Checkout/Model/Session.php(38): Mage_Core_Model_Session_Abstract->init('checkout')
       #3 /home/magento/public_html/app/code/core/Mage/Core/Model/Config.php(1254): Mage_Checkout_Model_Session->__construct(Array)
       #4 /home/magento/public_html/app/Mage.php(432): Mage_Core_Model_Config->getModelInstance('checkout/sessio...', Array)
       #5 /home/magento/public_html/app/Mage.php(446): Mage::getModel('checkout/sessio...', Array)
       #6 /home/magento/public_html/app/code/core/Mage/Checkout/Model/Cart.php(54): Mage::getSingleton(' in /home/magento/public_html/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 341

Solution

  • Found the reason. Lucky enough, Mage_Core_Model_Session_Exception only appears once in the Magento code which is thrown when the session fails validation, and it all came down to the HTTP user agent validator, so I just turned all validation off. No idea why the user agent would change during a session, since these are not hacking attempts and real customers.