Skip to content

Memory issue when updating category name #9706

@george-vlahakis

Description

@george-vlahakis

Memory allocation failure

Preconditions

Magento 2.1.6 CE
MySQL 5.6.35
PHP 7.0.15 (with mem limit = -1)

Two store (two languages) website.
~16.000 products
~160.000 customers
~800 categories

Steps to reproduce

Go to category (2nd store) and change the name.
Do Save.

Expected result

Save to work.

Actual result

Memory drained completely

Looking at the mysql general it seems that it is going through all the products under the category changed and looks to see if there is a url_rewrite needed.

This doesn't make much sense as the category name was changed only and the url_key was left the same (the one assigned in store 1).

But even so, why the memory consumption (and crash) ?

From what I can see and as far as I got, no UPDATE/INSERT statements executed.

This is the query that seems to look (product_id increments)

		  569 Query	SELECT `e`.*, `at_product_id`.`product_id` FROM `catalog_category_entity` AS `e`
 INNER JOIN `catalog_category_product` AS `at_product_id` ON (at_product_id.`category_id`=e.entity_id) WHERE (at_product_id.product_id = '13367')
		  569 Query	SELECT `t_d`.`attribute_id`, `e`.`entity_id`, `t_d`.`value` AS `default_value`, `t_s`.`value` AS `store_value`, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value` FROM `catalog_category_entity_varchar` AS `t_d`
 INNER JOIN `catalog_category_entity` AS `e` ON e.entity_id = t_d.entity_id
 LEFT JOIN `catalog_category_entity_varchar` AS `t_s` ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 1 WHERE (e.entity_id IN (88, 130, 701, 991)) AND (t_d.attribute_id IN ('124', '125')) AND (t_d.store_id = IFNULL(t_s.store_id, 0))
		  569 Query	SELECT `url_rewrite`.* FROM `url_rewrite` WHERE (`store_id` IN (1)) AND (`entity_id` IN ('13367')) AND (`entity_type` IN ('product'))
		  569 Query	SELECT `ce`.`entity_id`, `ci`.`value` FROM `catalog_category_entity` AS `ce`
 LEFT JOIN `catalog_category_entity_int` AS `ci` ON ci.entity_id = ce.entity_id AND attribute_id = '54' WHERE (ci.value = '1') AND (ce.entity_id IN ('1', '2', '3', '7', '83'))
		  569 Query	SELECT `ce`.`entity_id`, `ci`.`value` FROM `catalog_category_entity` AS `ce`
 LEFT JOIN `catalog_category_entity_int` AS `ci` ON ci.entity_id = ce.entity_id AND attribute_id = '54' WHERE (ci.value = '1') AND (ce.entity_id IN ('1', '2', '3', '7', '129'))
		  569 Query	SELECT `ce`.`entity_id`, `ci`.`value` FROM `catalog_category_entity` AS `ce`
 LEFT JOIN `catalog_category_entity_int` AS `ci` ON ci.entity_id = ce.entity_id AND attribute_id = '54' WHERE (ci.value = '1') AND (ce.entity_id IN ('1', '2', '3', '686', '687'))
		  569 Query	SELECT `ce`.`entity_id`, `ci`.`value` FROM `catalog_category_entity` AS `ce`
 LEFT JOIN `catalog_category_entity_int` AS `ci` ON ci.entity_id = ce.entity_id AND attribute_id = '54' WHERE (ci.value = '1') AND (ce.entity_id IN ('1', '2', '4'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions