-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions and environment
Hello Magento Support,
We have encountered a critical issue on our Magento CE V2.4.7 environment related to memory usage when attempting to update a customer's password from the Admin panel.
After extensive profiling and testing, here are our findings:
The issue occurs only when the PHP container memory limit is set below 2 GB.
It affects customer accounts with a large number of orders (2000+).
We disabled all non-native modules and performed a full Xdebug profiling.
Memory usage reaches ~700 MB before the script fails due to exhaustion.
When memory is saturated, critical resources such as cache and database operations fail, causing the script to terminate.
We suspect the issue is linked to Magento core behavior during the customer_save_before and customer_save_after events. Observers and plugins (native or third-party) may:
Query customer orders (statuses, totals, recent purchases) for syncing with ERP/CRM or loyalty rules.
Load related entities such as gift messages, addresses, and payment methods.
This behavior seems deeply tied to Magento’s internal entity management and dependency resolution. Direct modifications to core logic would pose a high risk of regression and instability.
Recommendation:
We currently mitigate the issue by setting the PHP memory limit to 2 GB, which aligns with Magento’s recommendations for high-data environments. However, we would appreciate any insights or suggestions from the Magento team regarding:
Optimizing memory usage during customer entity save operations.
Best practices for handling large customer datasets in Admin.
Whether this behavior is expected or if improvements are planned in future releases.
Thank you for your support.
Steps to reproduce
-Use a customer account that has more than 2000 orders.
-Go to the Admin panel → Customers → Edit the customer.
-Change the customer's email address or password.
-Click Save.
Expected result
Reduce or optimize memory consumption when saving a customer with a very large number of orders (2000+)
Actual result
Allowed memory size of 792723456 bytes exhausted (tried to allocate 24576 bytes)
Additional information
No response
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”.
Metadata
Metadata
Assignees
Type
Projects
Status