3

When running the Magento 2 indexer process from the CLI with command:

./magento indexer:reindex customer_grid

I get the following error:

PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 280224918230723 bytes) in /www/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228

The number of bites it tries to allocate is unrealistic. so increasing the memory limit is no option ( Also I think 1GB is already way too much.

I tried manually setting the index to invalid via the database and retrying to index. but this does not change anything. I also can’t find a matching table in the DB to flus as this did solve the problem in Magento 1.x.

The server runs on PHP version 7.0.0 and MariaDB version 10.1.9

1
  • try ./magento -d memory_limit=2048M indexer:reindex customer_grid. I had the same problem and this worked for me Jun 30, 2016 at 10:58

3 Answers 3

2

It is a bug (a memory leak) in PHP 7.
PHP 7 is not ready yet to run such a complex software like Magento 2: you will get a lot of segfaults, memory leaks, etc.
I recommend to check it again in a month, may be it will be fixed in PHP 7.

1
  • We have downgraded to PHP 5.6 This indeed solved the above problem and lots of other issues we had. Thx! Dec 24, 2015 at 14:34
7

Try this, it will take memory in run time:

For Linux

-dmemory_limit=2G magento indexer:reindex

For Windows as well as Linux

php -dmemory_limit=2G magento indexer:reindex

2
  • Hi Yogesh, Thanks for the suggestion. But as I stated in my initial question. Giving 2GB to a script is a bit extreme.... Also I am running all sites on PHP 7.0.7 which also solved the problem. Jul 1, 2016 at 14:14
  • I mean its and one time solutions, i faced the same but after allocating memory size within the query on fly worked for me.. please post if you got anything on the same. Jul 5, 2016 at 10:45
1

This is an old question, but there is a patch for this issue

https://gist.github.com/mpchadwick/a627b4fe6e5299cd3e8f1fdf57cf9b6c

It is also fixed in core if you upgrade to 2.2.X

https://github.com/magento/magento2/commit/6d98e2a57059ef75d9d0dd0585b84bb33953e107

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.