Deadlock occur during mass product import programatically

database
mysql
magento22

(Rajat Thakur) #1

Hello,

I am importing products programmatically using custom scripts but after sometime, I am getting deadlock error. Please let me know how to solve this issue.

Thanks


(Dmitry Fedyuk) #2

Which message do you receive exactly?


(Rajat Thakur) #3

Here is the error message I am getting

SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction, query was: UPDATE catalog_product_flat_4_tmp_indexer AS et
INNER JOIN catalog_product_entity AS e ON e.entity_id = et.entity_id
INNER JOIN catalog_product_entity_text AS t ON t.entity_id = e.entity_id AND t.attribute_id=675 AND t.store_id = 4 AND t.value IS NOT NULL
SET et.barcode = t.value


(Dmitry Fedyuk) #4

You can try to solve it by increasing the innodb_lock_wait_timeout MySQL parameter’s value, but the best solution would be to optimize your script to avoid such locks.


(Rajat Thakur) #5

Thanks for the reply.
My current value is 50. Need to increase it and how much?

Thanks


(Rajat Thakur) #6

Thanks for the reply.
My current value is 50. Need to increase it and how much?


(Rajat Thakur) #7

Also I am getting this deadlock too


Next Zend_Db_Statement_Exception: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try
restarting transaction, query was: DELETE FROM `catalog_product_entity_int` WHERE (entity_id = 19403) AND (attribute_id = '570')
AND (`store_id` = 0) in /home/www-data/magento2.shishakoenig.ch/magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235