Skip to content

Saving catalog EAV attributes is not thread-safe #40126

@pmzandbergen

Description

@pmzandbergen

Preconditions and environment

Tested on 2.4.7-p6 and 2.4.8-p1

Steps to reproduce

  1. Create a dropdown or multi-select product attribute
  2. Using two synchrone PHP processes add an option with the same Admin value
  3. The attribute now contains two options with the same Admin value, which is not allowed

Cause: No lock is being placed allowing multiple processes to alter the EAV attribute
Solution: Use a write lock on the EAV attribute

This situation might be very unlikely when updating EAV attributes through the backend of Magento. When updating EAV attributes automatically, for example with a PIM integration, this does occur from time to time.

Expected result

One of the processes updating the EAV attribute should get an error or options should be combined automatically based on the Admin values.

Actual result

The attribute contains duplicate option values for the Admin.

Additional information

I'm not 100% sure if unique Admin option values is a requirement for catalog EAV attributes, or just EAV attributes in general. It makes sense to restrict duplicates in general, the current validation however is implemented in the Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate controller.

Release note

Workaround: Open the EAV attribute in backend and remove duplicate Admin option values.

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: ready for confirmationReported on 2.4.8-p1Indicates original Magento version for the Issue report.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    Status

    Ready for Confirmation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions