Skip to content

Extreme memory usage when applying catalog rules #3127

@ioweb-gr

Description

@ioweb-gr

Preconditions (*)

  1. OpenMage 20.0.10

Steps to reproduce (*)

  1. Create 11 catalog rules which apply discounts to products where category is one of 1,2,....N and at least 10 clauses where manufacturer is 1..N to apply a discount percentage
  2. Use a medium sized catalog of about 40K products
  3. Try to apply all rules

e.g.

image

Expected result (*)

  1. Rules are applied

Actual result (*)

  1. Memory exhausted. In my case it required 16GB of RAM to actually execute the \Mage_Adminhtml_Promo_CatalogController::applyRulesAction

e.g. to simulate in a CLI script

<?php
require_once('app/Mage.php');
umask(0);
Mage::app('admin');

ini_set('memory_limit', '1G');
Mage::getModel('catalogrule/rule')->applyAll();

Will yield

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 75497472 bytes) in /var/www/vhosts/example.com/httpdocs/app/code/community/Varien/Profiler.php on line 169

And it will crash until I put 16G in the limit.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions