Magento 2 Indexer – Allowed Memory Size Exhausted Error

indexermagento2

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

Best Answer

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.