ACP2E-4913: REST API shipment and invoice creation is not retried after a database deadlock
The ACP2E-4913 patch fixes the issue where creating a shipment or an invoice through the REST API fails permanently when a database deadlock occurs because the operation is not retried. This patch is available when the Quality Patches Tool (QPT) 1.1.84 is installed. The patch ID is ACP2E-4913. Please note that this issue is scheduled to be fixed in Adobe Commerce 2.4.10.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.8-p3
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.7 - 2.4.8-p5
magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.Issue
Creating a shipment or an invoice through the REST API fails permanently when a database deadlock occurs because the operation is not retried.
Steps to reproduce:
- Prepare several orders that can be shipped and several orders that can be invoiced.
- Send several
POST /rest/V1/order/<orderId>/shiprequests in parallel for these orders, as an integration might under load. - Send several
POST /rest/V1/order/<orderId>/invoicerequests in parallel in the same way. - Check the API responses and
var/log/exception.log.
Expected results:
After a deadlock, the operation is retried, and the shipment or invoice is created.
Actual results:
Some requests fail with the following deadlock error. The shipment or invoice is not created, and you must create it manually:
SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- Adobe Commerce or Magento Open Source on-premises: Quality Patches Tool > Usage in the Quality Patches Tool guide
- Adobe Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in the Commerce on Cloud Infrastructure guide
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool: A self-service tool for quality patches in the Tools guide