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
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the 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:

  1. Prepare several orders that can be shipped and several orders that can be invoiced.
  2. Send several POST /rest/V1/order/<orderId>/ship requests in parallel for these orders, as an integration might under load.
  3. Send several POST /rest/V1/order/<orderId>/invoice requests in parallel in the same way.
  4. 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:

To learn more about Quality Patches Tool, refer to:

recommendation-more-help
commerce-operations-help-tools