composer: PHP7 file limit? Out of memory (tried to allocate 561386817875360 bytes)
When I run this command:
$ composer dump-autoload --optimize -vvv
I get this output:
Reading ./composer.json
Loading config file /home/vagrant/.composer/config.json
Loading config file /home/vagrant/.composer/auth.json
Loading config file ./composer.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/var/www/sylius): git branch --no-color --no-abbrev -v
Reading /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/config.json
Loading config file /home/vagrant/.composer/auth.json
Loading config file /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/auth.json
Reading /home/vagrant/.composer/auth.json
Reading /var/www/sylius/vendor/composer/installed.json
Reading /home/vagrant/.composer/vendor/composer/installed.json
Running 1.2.0 (2016-07-19 01:28:52) with PHP 7.0.6 on Linux / 3.10.0-327.13.1.el7.x86_64
Generating optimized autoload files
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 27570176) (tried to allocate 561386817875360 bytes) in phar:///var/chef/cache/composer/composer.phar/src/Composer/Autoload/AutoloadGenerator.php on line 755
Fatal error: Out of memory (allocated 27570176) (tried to allocate 561386817875360 bytes) in phar:///var/chef/cache/composer/composer.phar/src/Composer/Autoload/AutoloadGenerator.php on line 755
And I expected it to build the autoloader normally as it does every day.
We experienced this issue at what appears to be some kind of file/class limit, because…:
$ mv src/Some/Random/Class.php ../
$ composer dump-autoload --optimize -vvv
Reading ./composer.json
Loading config file /home/vagrant/.composer/config.json
Loading config file /home/vagrant/.composer/auth.json
Loading config file ./composer.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/var/www/sylius): git branch --no-color --no-abbrev -v
Reading /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/config.json
Loading config file /home/vagrant/.composer/auth.json
Loading config file /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/auth.json
Reading /home/vagrant/.composer/auth.json
Reading /var/www/sylius/vendor/composer/installed.json
Reading /home/vagrant/.composer/vendor/composer/installed.json
Running 1.2.0 (2016-07-19 01:28:52) with PHP 7.0.6 on Linux / 3.10.0-327.13.1.el7.x86_64
Generating optimized autoload files
It builds fine.
Then:
$ mv ../Class.php src/Some/Random/
$ composer dump-autoload --optimize -vvv
it fails again.
Then move a different class out:
$ mv src/A/Different/File.php ../
$ composer dump-autoload --optimize -vvv
it works.
It doesn’t matter which file we add/remove, we just seem to have hit a limit where it blows up.
https://github.com/composer/composer/blob/master/src/Composer/Autoload/AutoloadGenerator.php#L755
I was about to start debugging but I’m not sure how to go about unpacking and rebuilding the composer.phar file…
Our application has a large code base and a lot of deps.
The following composer.json:
{
"name": "reiss/reiss",
"type": "project",
"description": "Reiss.com Ecommerce Platform",
"license": "proprietary",
"homepage": "http://www.reiss.com",
"authors": [
{
"name": "Reiss",
"homepage": "http://www.reiss.com"
}
],
"require": {
"php": "^5.6.0|^7.0",
"symfony/symfony": "^2.8.0",
"sylius/sylius": "dev-stable",
"doctrine/migrations": "~1.0@dev,<1.3.0",
"egeloen/google-map-bundle": "^2.2",
"egulias/email-validator": "^1.0",
"ezyang/htmlpurifier": "^4.7",
"fastly/fastly": "~0.2",
"geoip2/geoip2": "~2.0",
"giggsey/libphonenumber-for-php": "^7.4",
"guzzlehttp/guzzle": "^6.2",
"h4cc/wkhtmltopdf-amd64": "0.12.x",
"hampe/zurb-ink-bundle": "~1.0",
"herzult/php-ssh": "~1.0@dev",
"html2text/html2text": "dev-master",
"hwi/oauth-bundle": "~0.3",
"league/csv": "^8.0",
"liip/imagine-bundle": "~1.0@dev",
"lstrojny/functional-php": "dev-master",
"mandrill/mandrill": "~1.0",
"misd/phone-number-bundle": "^1.1",
"nelmio/security-bundle": "^2.0",
"oro/doctrine-extensions": "dev-master",
"payum/omnipay-bridge": "*@stable",
"php-amqplib/php-amqplib": "^2.6",
"php-amqplib/rabbitmq-bundle": "^1.7",
"php-ews/php-ews": "dev-master",
"roave/security-advisories": "dev-master",
"snc/redis-bundle": "dev-master",
"suncat/mobile-detect-bundle": "0.10.*",
"vich/uploader-bundle": "~1.0@dev",
"willdurand/geocoder": "~2.8"
},
"require-dev": {
"behat/behat": "^3.1.0",
"behat/mink": "~1.6",
"behat/mink-browserkit-driver": "~1.2",
"behat/mink-extension": "~2.0",
"behat/mink-selenium2-driver": "~1.2",
"behat/symfony2-extension": "~2.0",
"behatch/contexts": "*",
"bossa/phpspec2-expect": "*",
"coduo/php-matcher": "^2.1@dev",
"coduo/phpspec-data-provider-extension": "dev-master",
"phpspec/phpspec": "^2.4",
"phpunit/phpunit": "~4.1",
"sensio/generator-bundle": "dev-master",
"symfony/phpunit-bridge": "^3.1"
},
"scripts": {
"post-install-cmd": [
"Reiss\\Bundle\\StoreBundle\\Composer\\ScriptHandler::ensureParameters",
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
],
"pre-update-cmd": [
"Reiss\\Bundle\\StoreBundle\\Composer\\Script\\ChangeComparator::saveCurrentVersionOfRepository"
],
"post-update-cmd": [
"Reiss\\Bundle\\StoreBundle\\Composer\\ScriptHandler::ensureParameters",
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Reiss\\Bundle\\StoreBundle\\Composer\\Script\\ChangeComparator::compareCurrentVersionWithPrevious"
]
},
"autoload": {
"psr-4": {"Sylius\\": "src/Sylius", "Reiss\\" : "src/Reiss" , "BackBee\\": "src/BackBee" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": [
{
"file": "app/config/parameters/main.yml",
"dist-file": "app/config/parameters/main.dist.yml"
},
{
"file": "app/config/parameters/server.yml",
"dist-file": "app/config/parameters/server.vagrant.yml"
},
{
"file": "app/config/parameters/environment.yml",
"dist-file": "app/config/parameters/environment.non-live.yml"
}
],
"compare": {
"vendor/sylius/sylius": [
"app/config",
"app/Resources",
"app/AppCache.php",
"app/AppKernel.php",
"src/Sylius/Bundle/CoreBundle/Resources/config",
"src/Sylius/Bundle/InventoryBundle/Resources/config/state-machine.yml",
"src/Sylius/Bundle/OrderBundle/Resources/config/state-machine.yml",
"src/Sylius/Bundle/PaymentBundle/Resources/config/state-machine.yml",
"src/Sylius/Bundle/ShippingBundle/Resources/config/state-machine.yml"
]
}
},
"minimum-stability": "stable",
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ReissClothing/Sylius"
}
]
}
Any help would be greatly appreciated. At the moment we’re “1 in, 1 out” with our codebase!
Thanks!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 52 (17 by maintainers)
I can confirm this does not fail on php5.6, only 7+ (tried 7.0.6, 7.0.8 and 7.0.9)