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

Non-Static Customer Custom Attribute Are Always Updated When Using Customer Repository to Save #38753

Closed
1 of 5 tasks
NateSwanson7 opened this issue May 24, 2024 · 21 comments
Closed
1 of 5 tasks
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.7 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@NateSwanson7
Copy link

Preconditions and environment

  • 2.4.7
  • At least one non-static custom attribute for the customer entity

Steps to reproduce

  1. Create a non-static customer custom attribute (e.g. my_custom_attribute)
  2. Set my_custom_attribute to any value and save
  3. Enable DB profiling
  4. Load up the customer using the Customer Repository (\Magento\Customer\Api\CustomerRepositoryInterface)
  5. Without changing any value save the customer using the Customer Repository (\Magento\Customer\Api\CustomerRepositoryInterface::save())
  6. Check DB profiling results
  7. Notice a query to insert the value that was already saved and set for your custom attribute my_custom_attribute even though the original value does not differ from the new value

Expected result

DB query to insert/update the value of the custom attribute is not created or ran because the value has not changed.

Actual result

DB query to insert/update the value of the custom attribute is created and ran even though the value does not differ.

Additional information

This can end up causing database deadlocks when the unnecessary insert/update query is ran which locks the row.

Release note

No response

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”.
Copy link

m2-assistant bot commented May 24, 2024

Hi @NateSwanson7. 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. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


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.

@NateSwanson7
Copy link
Author

@magento give me 2.4-develop instance

Copy link

Hi @NateSwanson7. Thank you for your request. I'm working on Magento instance for you.

@NateSwanson7
Copy link
Author

@magento I am working on this

Copy link

m2-assistant bot commented May 24, 2024

Hi @NateSwanson7! 👋
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

@NateSwanson7
Copy link
Author

@magento add to contributors team

Copy link

m2-assistant bot commented May 24, 2024

Hi @NateSwanson7! 👋
Thank you for joining. Please accept team invitation 👉 here 👈 and add your comment one more time.

@NateSwanson7
Copy link
Author

@magento I am working on this

Copy link

@engcom-Delta engcom-Delta self-assigned this May 26, 2024
Copy link

m2-assistant bot commented May 26, 2024

Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta engcom-Delta added the Reported on 2.4.7 Indicates original Magento version for the Issue report. label May 27, 2024
@engcom-Hotel engcom-Hotel added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label May 27, 2024
@engcom-Delta engcom-Delta removed their assignment May 27, 2024
@engcom-November engcom-November self-assigned this May 27, 2024
Copy link

m2-assistant bot commented May 27, 2024

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Hello @NateSwanson7,

Thank you for the report and collaboration!

We followed your steps to reproduce and created a not static customer custom attribute custom_field, but when saving the customer without changing any value led to below query:

SQL: INSERT  INTO `customer_grid_flat` (`entity_id`,`name`,`email`,`group_id`,`created_at`,`website_id`,`confirmation`,`created_in`,`dob`,`gender`,`taxvat`,`lock_expires`,`custom_field`,`shipping_full`,`billing_full`,`billing_firstname`,`billing_lastname`,`billing_telephone`,`billing_postcode`,`billing_country_id`,`billing_region`,`billing_region_id`,`billing_street`,`billing_city`,`billing_fax`,`billing_vat_id`,`billing_company`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE `name` = VALUES(`name`), `email` = VALUES(`email`), `group_id` = VALUES(`group_id`), `created_at` = VALUES(`created_at`), `website_id` = VALUES(`website_id`), `confirmation` = VALUES(`confirmation`), `created_in` = VALUES(`created_in`), `dob` = VALUES(`dob`), `gender` = VALUES(`gender`), `taxvat` = VALUES(`taxvat`), `lock_expires` = VALUES(`lock_expires`), `custom_field` = VALUES(`custom_field`), `shipping_full` = VALUES(`shipping_full`), `billing_full` = VALUES(`billing_full`), `billing_firstname` = VALUES(`billing_firstname`), `billing_lastname` = VALUES(`billing_lastname`), `billing_telephone` = VALUES(`billing_telephone`), `billing_postcode` = VALUES(`billing_postcode`), `billing_country_id` = VALUES(`billing_country_id`), `billing_region` = VALUES(`billing_region`), `billing_region_id` = VALUES(`billing_region_id`), `billing_street` = VALUES(`billing_street`), `billing_city` = VALUES(`billing_city`), `billing_fax` = VALUES(`billing_fax`), `billing_vat_id` = VALUES(`billing_vat_id`), `billing_company` = VALUES(`billing_company`)
BIND: array (
  0 => 1,
  1 => 'test test',
  2 => 'test@mail.com',
  3 => '1',
  4 => '2024-05-28 06:21:45',
  5 => '1',
  6 => NULL,
  7 => 'Default Store View',
  8 => NULL,
  9 => '0',
  10 => NULL,
  11 => NULL,
  12 => 'test data',
  13 => '',
  14 => '',
  15 => NULL,
  16 => NULL,
  17 => NULL,
  18 => NULL,
  19 => NULL,
  20 => NULL,
  21 => NULL,
  22 => NULL,
  23 => NULL,
  24 => NULL,
  25 => NULL,
  26 => NULL,
)
AFF: 1
TIME: 0.0008

We did not see a DB query specific to Customer Custom Attribute.

Please find the custom module used to reproduce this issue, and let us know if we are missing anyting.
I38753V.zip

Thank you.

@engcom-November engcom-November added the Issue: needs update Additional information is require, waiting for response label May 29, 2024
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board May 29, 2024
@NateSwanson7
Copy link
Author

@engcom-November I'll double check the steps I provided when I get a bit of time later this week.

Thanks

@sdouma
Copy link

sdouma commented Jun 4, 2024

@magento give me 2.4.4-p8 instance

Copy link

Hi @sdouma. Thank you for your request. I'm working on Magento instance for you.

Copy link

Hi @sdouma, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@sdouma
Copy link

sdouma commented Jun 4, 2024

@magento give me 2.4-develop instance

Copy link

Hi @sdouma. Thank you for your request. I'm working on Magento instance for you.

Copy link

@engcom-November
Copy link
Contributor

Hello @NateSwanson7,

Can you give us any updates on this.

@NateSwanson7
Copy link
Author

Hello @NateSwanson7,

Can you give us any updates on this.

@engcom-November I can't seem to reproduce this now, feel free to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.7 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
5 participants