0

Magento 1.9.2.1 has just started throwing the exception

'Mage_Core_Exception' with message 'Mage registry key "_singleton/admin/session" already exists'

it happens with different cron jobs - if I disable the extensions relating to the cron that triggers the error, then the error happens on a different cron job, but not all cron jobs.

Some of the cronjobs that trigger the error are successful after the 8th or 10th run.

I've spent the day googling and all i can find is reference to the compiler and clearing the cache - I've cleared the cache about a million times and the compiler has never been switched on - i've cleared it and run compiler --disable to be sure.

I'm absolutely stumped and would appreciate some help.

full exception here



Cron error while executing core_email_queue_send_all:

exception 'Mage_Core_Exception' with message 'Mage registry key "_singleton/admin/session" already exists' in /home/user/public_html/app/Mage.php:595

Stack trace:

#0 /home/user/public_html/app/Mage.php(223): Mage::throwException('Mage registry k...')
#1 /home/user/public_html/app/Mage.php(477): Mage::register('_singleton/admi...', Object(Mage_Admin_Model_Session))
#2 /home/user/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(546): Mage::getSingleton('admin/session')
#3 /home/user/public_html/app/code/core/Mage/Core/Model/Abstract.php(316): Aoe_Scheduler_Model_Schedule->_beforeSave()
#4 /home/user/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(196): Mage_Core_Model_Abstract->save()
#5 /home/user/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(609): Aoe_Scheduler_Model_Schedule->runNow(true)
#6 /home/user/public_html/app/code/community/Aoe/Scheduler/Model/Observer.php(39): Aoe_Scheduler_Model_Schedule->process()
#7 /home/user/public_html/app/code/core/Mage/Core/Model/App.php(1358): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#8 /home/user/public_html/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#9 /home/user/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#10 /home/user/public_html/cron.php(77): Mage::dispatchEvent('default')
#11 {main}
  • Do you have the full exception? – Phil M Nov 23 '16 at 23:55
  • yep - added above. As I mentioned, the process being executed may change but the exception is always exactly the same. – grizlyadams Nov 24 '16 at 16:16
1

Something is odd. Look at the function in Mage.php that is failing:

/**
 * Retrieve model object singleton
 *
 * @param   string $modelClass
 * @param   array $arguments
 * @return  Mage_Core_Model_Abstract
 */
public static function getSingleton($modelClass='', array $arguments=array())
{
    $registryKey = '_singleton/'.$modelClass;
    if (!self::registry($registryKey)) {
        self::register($registryKey, self::getModel($modelClass, $arguments));
    }
    return self::registry($registryKey);
}

Based on the logic of that function, on the second line it checks to see if the key is defined... and if not set it. The setting is causing the exception because technically the KEY does exist but the return value is unexpectedly evaluated as false (false, null, 0, etc).

I have no idea why Mage_Admin_Model_Session would ever evaluate to false unless the class 'admin/session' couldn't be loaded for some reason. Although now that I think about it, maybe Magento disabled the admin session in 1.9.2.1+ for CRON tasks because there is no point to the session.

Regardless, the extension that is causing this to break is the AOE Scheduler. There might be an update that fixes this.

| improve this answer | |
0

just for info

I reinstalled AOE_scheduler and updated Magento and that solved the problem

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.