Magento2: running catalog:images:resize out of memory with 6GB assigned to php

Created on 28 Jun 2017  路  5Comments  路  Source: magento/magento2

With a large catalog (250K+) products and images, if an attempt to run catalog:images:resize, eventually the command fails with "PHP Fatal error: Allowed memory size of 6442450944 bytes exhausted (tried to allocate 20480 bytes) in /vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 291"

There is no way to batch this command into smaller processes.

Preconditions


  1. Magento 2.1.3+
  2. PHP 7.0.20
  3. MySQL
  4. NginX Hosted service

Steps to reproduce

  1. Import a LARGE amount of products into Magento catalog with images (250,000+ products)
  2. Make sure your PHP is set to allow x GB in memory (my host max is 6GB for php).
  3. run catalog:images:resize, eventually a PHP out of memory error will occur.

Expected result

  1. The command should be able to be run with a memory size limit set, once that memory limit is reached, it should be able to stop, and re-start from where it left off.
    or have a sub-set of commands like:
  • catalog:images:resize new (start from the beginning).
  • catalog:images:resize continue (restart from where it last ended).
  • catalog:images:resize refresh (on process those images which have not been previously processed).

Actual result

  1. With my PHP memory maxxed for my host (6GB) I run out of memory on attempting to run catalog:images:resize.
Clear Description Format is valid Dev.Experience bug report

Most helpful comment

I can confirm this issue. we assigned 5GB to php still our 100k sku catalog failed to resize images. ultimately we had to make a different store with less SKUs and copy image to our original media folder. Mage2 is an impossible platform to use in production.

All 5 comments

I can confirm this issue. we assigned 5GB to php still our 100k sku catalog failed to resize images. ultimately we had to make a different store with less SKUs and copy image to our original media folder. Mage2 is an impossible platform to use in production.

@spyrule, thank you for your report.
We've created internal ticket(s) MAGETWO-80699 to track progress on the issue.

Hi @engcom-Charlie. 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: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components 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.

Hello @spyrule
Thank you for contribution and collaboration!

We are not able to reproduce this issue on the latest 2.4-develop branch by provided steps.

Testing scenario:

  1. Import a LARGE amount of products into Magento catalog with images (100,000+ products)
  2. PHP is set to allow x GB in memory (my host max is 2GB for php).
    image
  3. run catalog:images:resize

Result:
catalog:images:resize works fine
ended

We are closing this issue due to branch 2.2-develop was closed and

Magento no longer accepts pull requests and issues to the v2.2 release lines to focus all development efforts on v2.3.

See Accepted pull requests and ported code for more details

If you still faced this issue on 2.3 please create a new Issue with all required details according to Issue reporting guidelines

Thanks for your report!

I should mention, I no longer work for the company that had this huge catalog. They got fed up with Magento's broken product management, and dropped Magento completely. I now work for a company that has a tiny catalog by comparison, and have not experienced this issue since.

Was this page helpful?
0 / 5 - 0 ratings