Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock Error in Magento 2 During High Concurrency: Serialization failure on cataloginventory_stock_item Table #39417

Open
talsan74 opened this issue Dec 2, 2024 · 1 comment
Labels
Issue: ready for confirmation Reported on 2.4.7 Indicates original Magento version for the Issue report.

Comments

@talsan74
Copy link

talsan74 commented Dec 2, 2024

Preconditions (*)

  1. Magento: 2.4.7
  2. PHP: 8.3
  3. RDS MYSQL: 8.0 16GB Memory

Steps to reproduce (*)

  1. Install Default Magento
  2. Cron for every 1 minitue
  3. Added 10k products
  4. Run Stress Test for 100 users using JMeter
  5. Trying to place order using graphql

Expected result (*)

  1. 100% will be placed

Actual result (*)

Out of 100 orders, a single-digit order is regularly missing. Resource metrics are fine. This issue only occurs during the stress test, not during manual execution. The logs are being retrieved in Magento.

main.ERROR: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: SELECT `si`.* FROM `cataloginventory_stock_item` AS `si` WHERE (item_id IN (4475, 4522, 4679, 8444, 8745)) FOR UPDATE

GraphQL (3:7)
    mutation {
       placeOrder(input: { cart_id: "Zsasfghssdfgghfghghjgs" }) {
         ^
       order {
 {"exception":"[object] (GraphQL\\Error\\Error(code: 0): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: SELECT `si`.* FROM `cataloginventory_stock_item` AS `si` WHERE (item_id IN (4475, 4522, 4679, 8444, 8745)) FOR UPDATE at /var/www/html/vendor/webonyx/graphql-php/src/Error/Error.php:170)
[previous exception] [object] (Magento\\Framework\\DB\\Adapter\\DeadlockException(code: 1213): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: SELECT `si`.* FROM `cataloginventory_stock_item` AS `si` WHERE (item_id IN (4475, 4522, 4679, 8444, 8745)) FOR UPDATE at /var/www/html/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php:672)
[previous exception] [object] (Zend_Db_Statement_Exception(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: SELECT `si`.* FROM `cataloginventory_stock_item` AS `si` WHERE (item_id IN (4475, 4522, 4679, 8444, 8745)) FOR UPDATE at /var/www/html/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php:109)
[previous exception] [object] (PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php:90)"} []
Copy link

m2-assistant bot commented Dec 2, 2024

Hi @talsan74. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@github-project-automation github-project-automation bot moved this to Ready for Confirmation in Issue Confirmation and Triage Board Dec 2, 2024
@engcom-Bravo engcom-Bravo added the Reported on 2.4.7 Indicates original Magento version for the Issue report. label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: ready for confirmation Reported on 2.4.7 Indicates original Magento version for the Issue report.
Projects
Status: Ready for Confirmation
Development

No branches or pull requests

2 participants