Deadlock occur during mass product import programatically

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

Which message do you receive exactly?

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

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.

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

Thanks

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

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

Hi Rajat

How did you fix this issue.