ACP2E-4603: Catalog Permissions product reindex leave stale permission index rows and MySQL deadlock

The ACP2E-4603 patch fixes the issue where Catalog Permissions product reindexing leaves existing permission index rows unchanged, so updated category permission grants don’t reflect correctly on products. This patch is available when the Quality Patches Tool (QPT) 1.1.79 is installed. The patch ID is ACP2E-4603. Please note that this issue is scheduled to be fixed in Adobe Commerce 2.4.9.

Affected products and versions

The patch is created for Adobe Commerce version:

  • Adobe Commerce (all deployment methods) 2.4.7-p3

Compatible with Adobe Commerce versions:

  • Adobe Commerce (all deployment methods) 2.4.6 - 2.4.7-p9
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

Catalog Permissions product reindexing leaves existing permission index rows unchanged, so updated category permission grants don’t reflect correctly on products.

Steps to reproduce:

  1. Enable Category Permissions:

    1. Log in to the Admin.
    2. Go to Stores > Configuration.
    3. Under Catalog, select Catalog.
    4. Expand Category Permissions.
    5. Set Enable to Yes.
    6. Save the Configuration.
  2. Create 50 or more customer groups (Option A or Option B):

    1. Option A — Admin: Go to Customers > Customer Groups and select Add New. Enter a group name (for example, ACSD70034_01) and select the default tax class, then Save. Repeat to create 50 or more groups.
    2. Option B (recommended) — REST API: Send a POST request to /rest/V1/customerGroups with the request body {"group":{"code":"ACSD70034_01","taxClassId":0}}. Repeat to create 50 groups (ACSD70034_01 through ACSD70034_50).
  3. Add category permissions in Admin:

    1. Go to Catalog > Categories.
    2. Edit 10–20 or more categories to increase reproducibility.
    3. In each category, scroll to Category Permissions and select Add Permission.
    4. Select a website (for example, Main Website) and assign one of the previously created customer groups.
    5. Configure Grant Catalog Category View, Grant Product Price, and Grant Checkout as required.
    6. Select Save.
    7. Recommended scale: Create a larger data set (for example, 20 categories and 20–50 customer groups) to generate 400–1,000 permission rows.
  4. Ensure a single index table (default):

    1. Go to Stores > Configuration > Catalog > Catalog > Category Permissions.
    2. If Dimensions or Indexer Dimensions appears, set it to None (not Customer Group) to use a single index table.
  5. Run reindex with parallel threads from the CLI:

    1. Export MAGE_INDEXER_THREADS_COUNT=4.
    2. Run php bin/magento indexer:reset catalogpermissions_category catalogpermissions_product.
    3. Run php bin/magento indexer:reindex catalogpermissions_category catalogpermissions_product.
    4. Repeat the reset and reindex commands 5–10 times to reproduce the deadlock during parallel execution.

Expected results:

Reindex completes successfully with parallel threads, and updated category permission grants reflect correctly on products in the magento_catalogpermissions_index_product table.

Actual results:

A MySQL deadlock error (1213) occurs intermittently during reindex, and child processes fail with errors referencing REPLACE INTO on magento_catalogpermissions_index_replica or magento_catalogpermissions_index_product.

Even when reindex completes without errors, it does not update existing permission index rows, so products continue to reflect stale category permission grants.

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