I have created a script to import inventory from CSV file. The script is ran with a cronjob that runs every 3 hours. It worked fine until I have a csv file that contains 11000 lines, and I got the following error every time I try to import this csv.

How can I avoid this error?

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction' in /public/lib/Zend/Db/Statement/Pdo.php:228

Stack trace:
#0 /public/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /public/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /public/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /public/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /public/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE `index_p...', Array)
#5 /public/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `index_p...', Array)
#6 /public/lib/Zend/Db/Ada in /public/lib/Zend/Db/Statement/Pdo.php on line 235

Your Answer

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

Browse other questions tagged or ask your own question.