1

The magento works fine, and suddently starts giving an exception. The report says:

a:5:{i:0;s:96:"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '213894' for key 'PRIMARY'";i:1;s:2966:"#0 /public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ma...', Array)
#4 /public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ma...', Array)
#5 /public_html/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ma...', Array)
#6 /public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(154): Zend_Db_Adapter_Abstract->insert('mage_log_visito...', Array)
#7 /public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(108): Mage_Log_Model_Resource_Visitor->_saveVisitorInfo(Object(Mage_Log_Model_Visitor))
#8 /public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(458): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#9 /public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#10 /public_html/app/code/core/Mage/Log/Model/Visitor.php(167): Mage_Core_Model_Abstract->save()
#11 /public_html/app/code/core/Mage/Core/Model/App.php(1303): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#12 /public_html/app/code/core/Mage/Core/Model/App.php(1284): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#13 /public_html/app/Mage.php(416): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#14 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(505): Mage::dispatchEvent('controller_acti...', Array)
#15 /public_html/app/code/core/Mage/Core/Controller/Front/Action.php(59): Mage_Core_Controller_Varien_Action->preDispatch()
#16 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(409): Mage_Core_Controller_Front_Action->preDispatch()
#17 /public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('view')
#18 /public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /public_html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch()
#20 /public_html/app/Mage.php(639): Mage_Core_Model_App->run(Array)
#21 /public_html/index.php(98): Mage::run('', 'store')
#22 {main}";s:3:"url";s:37:"/illustrator-men-business-attire.html";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

The last line (22) is changing with different URLs in the different report files.

I have managed to get the website by restoring the database from the backup of 2 days ago. But after a few hours the same error appears.

2
  • Great hint from Dominic Xigen, that pointed me t the right database table. I have truncated the Magento database table log_visitor and the website started working again. Commented May 21, 2019 at 15:43
  • Glad it helped you. Please can you mark my answer as accepted. Commented May 21, 2019 at 21:35

1 Answer 1

2

Seems to be taking issue with the visitor log mechanism. Apologies you haven't said which version you are running.

You have a lot of options with regards to logging in M1.

You can disable a lot with this option.

https://bobcares.com/blog/magento-disable-visitor-log/

Not directly solving the problem though. Just offering a work-around solution to this particular error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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