Please note:
Disabling the report_viewed_product_index
event resolves the issue, at the cost of disabling the product view report index. (Source: How to disable report viewed products in magento)
I'm experiencing the following issue:
Serious bug in Reports module (Magento 1&2) #1018
I checked my exception.log and found the stack trace identical to that of the aforementioned link.
Edit 2:
We are using a full page cache (Extendware - Full Page Cache which is why 15, 16 & 17 lie in var/cache/
), as soon as another visitor successful loads the page & primes it into the cache, the first visitor can now view the product. It definitely sounds like the above-mentioned bug report as this behaviour supports that.
I'm getting the following error when trying to load a specific product page (not technically specific, as this changes randomly and some day the product which triggers it will not trigger it on another day. Specific in the sense that not every product page triggers the error.). The report reads:
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3015-14303' for key 'UNQ_REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID', query was: INSERT INTO `report_viewed_product_index` (`visitor_id`,`customer_id`,`product_id`,`store_id`,`added_at`) VALUES (?, ?, ?, ?, '2015-07-30 13:55:11') ON DUPLICATE KEY UPDATE `visitor_id` = VALUES(`visitor_id`), `customer_id` = VALUES(`customer_id`), `product_id` = VALUES(`product_id`), `store_id` = VALUES(`store_id`), `added_at` = VALUES(`added_at`)' in html/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `re...', Array)
#4 html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `re...', Array)
#5 html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1934): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `re...', Array)
#6 html/app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php(48): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('report_viewed_p...', Array, Array)
#7 html/app/code/core/Mage/Reports/Model/Resource/Product/Index/Abstract.php(150): Mage_Reports_Model_Resource_Helper_Mysql4->mergeVisitorProductIndex('report_viewed_p...', Array, Array)
#8 html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Reports_Model_Resource_Product_Index_Abstract->save(Object(Mage_Reports_Model_Product_Index_Viewed))
#9 html/app/code/core/Mage/Reports/Model/Event/Observer.php(130): Mage_Core_Model_Abstract->save()
#10 html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Reports_Model_Event_Observer->catalogProductView(Object(Varien_Event_Observer))
#11 html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Reports_Model_Event_Observer), 'catalogProductV...', Object(Varien_Event_Observer))
#12 html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('catalog_control...', Array)
#13 html/app/code/core/Mage/Catalog/Helper/Product/View.php(135): Mage::dispatchEvent('catalog_control...', Array)
#14 html/app/code/core/Mage/Catalog/controllers/ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(14303, Object(Mage_Catalog_ProductController), Object(Varien_Object))
#15 html/var/cache/ew/files/14/b3/Mage/Core/Controller/Varien/Action.php(437): Mage_Catalog_ProductController->viewAction()
#16 html/var/cache/ew/files/c5/3b/Mage/Core/Controller/Varien/Router/Standard.php(273): Mage_Core_Controller_Varien_ActionOverriddenClass->dispatch('view')
#17 html/var/cache/ew/files/26/1a/Mage/Core/Controller/Varien/Front.php(191): Mage_Core_Controller_Varien_Router_StandardOverriddenClass->match(Object(Mage_Core_Controller_Request_Http))
#18 html/app/code/local/Extendware/EWPageCache/Controller/Override/Mage/Core/Varien/Front.php(35): Mage_Core_Controller_Varien_FrontOverriddenClass->dispatch()
#19 html/app/code/core/Mage/Core/Model/App.php(354): Extendware_EWPageCache_Controller_Override_Mage_Core_Varien_Front->dispatch()
#20 html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#21 html/index.php(89): Mage::run('', 'store')
#22 {main}