Skip to content

Lock wait timeout during import of products #31

Description

@wienczny

We get an error message during import products that is caused by AsyncIndex. While AsyncIndex is disabled there is no error. When it is enabled the error below is shown after ~20 products.

Product: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction, query was: UPDATE `index_process` SET `status` = ? WHERE (process_id='2')

#0 /httpdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) 
#1 /httpdocs/app/code/core/Zend/Db/Statement.php(311): Varien_Db_Statement_Pdo_Mysql->_execute(Array) 
#2 /httpdocs/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array) 
#3 /httpdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE `index_p...', Array) 
#4 /httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `index_p...', Array) 
#5 /httpdocs/lib/Zend/Db/Adapter/Abstract.php(635): Varien_Db_Adapter_Pdo_Mysql->query('UPDATE `index_p...', Array) 
#6 /httpdocs/app/code/core/Mage/Index/Model/Resource/Process.php(137): Zend_Db_Adapter_Abstract->update('index_process', Array, Array) 
#7 /httpdocs/app/code/core/Mage/Index/Model/Resource/Process.php(124): Mage_Index_Model_Resource_Process->_updateProcessData('2', Array) 
#8 /httpdocs/app/code/core/Mage/Index/Model/Process.php(145): Mage_Index_Model_Resource_Process->updateStatus(Object(Mage_Index_Model_Process), 'require_reindex') 
#9 [internal function]: Mage_Index_Model_Process->register(Object(Mage_Index_Model_Event)) 
#10 /httpdocs/app/code/core/Mage/Index/Model/Indexer.php(378): call_user_func_array(Array, Array) 
#11 /httpdocs/app/code/core/Mage/Index/Model/Indexer.php(258): Mage_Index_Model_Indexer->_runAll('register', Array) 
#12 /httpdocs/app/code/core/Mage/Index/Model/Indexer.php(279): Mage_Index_Model_Indexer->registerEvent(Object(Mage_Index_Model_Event)) 
#13 /httpdocs/app/code/core/Mage/Index/Model/Indexer.php(298): Mage_Index_Model_Indexer->logEvent(Object(Varien_Object), 'catalog_product', 'catalog_reindex...', false) 
#14 /httpdocs/app/code/core/Mage/CatalogRule/Model/Rule.php(356): Mage_Index_Model_Indexer->processEntityAction(Object(Varien_Object), 'catalog_product', 'catalog_reindex...') 
#15 /httpdocs/app/code/core/Mage/CatalogRule/Model/Observer.php(60): Mage_CatalogRule_Model_Rule->applyAllRulesToProduct(Object(MGS_Abrands_Model_Product)) 
#16 /httpdocs/app/code/core/Mage/Core/Model/App.php(1358): Mage_CatalogRule_Model_Observer->applyAllRulesOnProduct(Object(Varien_Event_Observer)) 
#17 /httpdocs/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Mage_CatalogRule_Model_Observer), 'applyAllRulesOn...', Object(Varien_Event_Observer)) 
#18 /httpdocs/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('catalog_product...', Array) 
#19 /httpdocs/app/code/core/Mage/Core/Model/Abstract.php(344): Mage::dispatchEvent('catalog_product...', Array) 
#20 /httpdocs/app/code/core/Mage/Catalog/Model/Product.php(2083): Mage_Core_Model_Abstract->afterCommitCallback() 
#21 [internal function]: Mage_Catalog_Model_Product->afterCommitCallback() 
#22 /httpdocs/app/code/core/Mage/Core/Model/Resource/Abstract.php(110): call_user_func(Array) 
#23 /httpdocs/app/code/core/Mage/Core/Model/Abstract.php(322): Mage_Core_Model_Resource_Abstract->commit() 
#24 /httpdocs/app/code/local/Datame/Etl/lib/timeoutControllerEtl/timeoutControllerDestinationMagentoImportApi_Simple.php(455): Mage_Core_Model_Abstract->save() 
#25 /httpdocs/app/code/local/Datame/Etl/lib/timeoutController/timeoutController.php(151): timeoutControllerDestinationMagentoImportApi_Simple->execute(Array) 
#26 /httpdocs/app/code/local/Datame/Etl/Model/Etl.php(191): TimeoutController->execute(Object(TimeoutControllerSourceCsv), Object(timeoutControllerDestinationMagentoImportApi_Simple)) 
#27 /httpdocs/app/code/local/Datame/Etl/Block/Adminhtml/Etl/Import/Tablist.php(38): Datame_Etl_Model_Etl->executeNextStep() 
#28 /httpdocs/app/code/local/Datame/Etl/Block/Adminhtml/Etl/Import/Tablist.php(69): Datame_Etl_Block_Adminhtml_Etl_Import_TabList->execute(Object(stdClass)) 
#29 /httpdocs/app/code/local/Datame/Etl/Block/Adminhtml/Etl/Import/Tablist.php(18): Datame_Etl_Block_Adminhtml_Etl_Import_TabList->getSteps() 
#30 /httpdocs/app/code/core/Mage/Core/Model/Layout.php(491): Datame_Etl_Block_Adminhtml_Etl_Import_TabList->__construct(Array) 
#31 /httpdocs/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('etl/adminhtml_e...', Array) 
#32 /httpdocs/app/code/local/Datame/Etl/controllers/Adminhtml/EtlController.php(176): Mage_Core_Model_Layout->createBlock('etl/adminhtml_e...') 
#33 /httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Datame_Etl_Adminhtml_EtlController->importAction() 
#34 /httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('import') 
#35 /httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) 
#36 /httpdocs/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() 
#37 /httpdocs/app/Mage.php(684): Mage_Core_Model_App->run(Array) 
#38 /httpdocs/index.php(86): Mage::run('default', 'store') 
#39 {main}

I think this is related to the status updates. Maybe the updated should only be done when the value actually changed?

if ( count(Mage::getResourceSingleton('index/event')->getUnprocessedEvents($process) ) === 0 && $process->getStatus !== Mage_Index_Model_Process::STATUS_PENDING) {
    $process->changeStatus(Mage_Index_Model_Process::STATUS_PENDING);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions