composer: Composer runs out of memory on latest version

Hey there, I did a composer selfupdate and it updated fine. However most composer commands now throw an out of memory error at random points.

I think my rollback version is a 2.X version whereas running composer self-update seems to drop me down to a 1.X version (is this causing the issue?)

Windows 10 Cygwin

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.10.7
PHP version: 7.3.7
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 1.1.1c  28 May 2019

When I run this command:

laravel new blog
composer clearcache
composer install

I get the following output:

/tmp/blog [0] $ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 97 installs, 0 updates, 0 removals
  - Installing doctrine/inflector (2.0.3): Downloading (100%)
  - Installing doctrine/lexer (1.2.1): Downloading (100%)
  - Installing dragonmantank/cron-expression (v2.3.0): Downloading (100%)
  - Installing voku/portable-ascii (1.5.1): Downloading (100%)
  - Installing symfony/polyfill-ctype (v1.17.0): Downloading (100%)
  - Installing phpoption/phpoption (1.7.4): Downloading (100%)
  - Installing vlucas/phpdotenv (v4.1.7): Downloading (connecting...)
Downloading (100%)
  - Installing symfony/css-selector (v5.1.1): Downloading (100%)
  - Installing tijsverkoyen/css-to-inline-styles (2.2.2):Downloading (100%)         )
  - Installing symfony/polyfill-php80 (v1.17.0): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.17.0): Downloading (100%)
  - Installing symfony/var-dumper (v5.1.1): Downloading (100%)
  - Installing symfony/deprecation-contracts (v2.1.2): Downloading (100%)
  - Installing symfony/routing (v5.1.1): Downloading (100%)
  - Installing symfony/process (v5.1.1): Downloading (100%)
  - Installing symfony/polyfill-php73 (v1.17.0): Downloading (100%)
  - Installing symfony/polyfill-php72 (v1.17.0): Downloading (100%)
  - Installing symfony/polyfill-intl-idn (v1.17.0): Downloading (100%)
  - Installing symfony/mime (v5.1.1): Downloading (100%)
  - Installing symfony/http-foundation (v5.1.1): Downloading (100%)
  - Installing psr/event-dispatcher (1.0.0): Downloading (100%)
  - Installing symfony/event-dispatcher-contracts (v2.1.2): Downloading (connecting..Downloading (100%)
  - Installing symfony/event-dispatcher (v5.1.1): Downloading (100%)
  - Installing psr/log (1.1.3): Downloading (100%)
  - Installing symfony/error-handler (v5.1.1): Downloading (100%)
  - Installing symfony/http-kernel (v5.1.1): Downloading (100%)
  - Installing symfony/finder (v5.1.1): Downloading (100%)
  - Installing symfony/polyfill-intl-normalizer (v1.17.0): Downloading (connecting...Downloading (100%)
  - Installing symfony/polyfill-intl-grapheme (v1.17.0): Downloading (100%)
  - Installing symfony/string (v5.1.1): Downloading (100%)
  - Installing psr/container (1.0.0): Downloading (100%)
  - Installing symfony/service-contracts (v2.1.2): Downloading (100%)
  - Installing symfony/console (v5.1.1): Downloading (100%)
  - Installing symfony/polyfill-iconv (v1.17.0): Downloading (100%)
  - Installing egulias/email-validator (2.1.17): Downloading (100%)
  - Installing swiftmailer/swiftmailer (v6.2.3): Downloading (100%)
  - Installing ramsey/collection (1.0.1): Downloading (100%)
  - Installing brick/math (0.8.15): Downloading (100%)
  - Installing ramsey/uuid (4.0.1): Downloading (100%)
  - Installing psr/simple-cache (1.0.1): Downloading (100%)
  - Installing opis/closure (3.5.4): Downloading (100%)
  - Installing symfony/translation-contracts (v2.1.2): Downloading (100%)
  - Installing symfony/translation (v5.1.1): Downloading (100%)
  - Installing nesbot/carbon (2.35.0): Downloading (100%)
  - Installing monolog/monolog (2.1.0): Downloading (100%)
  - Installing league/flysystem (1.0.69): Downloading (100%)
  - Installing league/commonmark (1.4.3): Downloading (100%)
  - Installing laravel/framework (v7.15.0): Downloading (100%)
  - Installing fideloper/proxy (4.3.0): Downloading (100%)
  - Installing asm89/stack-cors (v2.0.1): Downloading (100%)
  - Installing fruitcake/laravel-cors (v2.0.1): Downloading (100%)
  - Installing ralouphie/getallheaders (3.0.3): Downloading (100%)
  - Installing psr/http-message (1.0.1): Downloading (100%)
  - Installing guzzlehttp/psr7 (1.6.1): Downloading (100%)
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
  - Installing guzzlehttp/guzzle (6.5.4): Downloading (100%)
  - Installing nikic/php-parser (v4.5.0): Downloading (100%)
  - Installing dnoegel/php-xdg-base-dir (v0.1.1): Downloading (100%)
  - Installing psy/psysh (v0.10.4): Downloading (100%)
  - Installing laravel/tinker (v2.4.0): Downloading (100%)
  - Installing scrivo/highlight.php (v9.18.1.1): Downloading (100%)
  - Installing filp/whoops (2.7.3): Downloading (100%)
  - Installing facade/ignition-contracts (1.0.0): Downloading (100%)
  - Installing facade/flare-client-php (1.3.2): Downloading (100%)
  - Installing facade/ignition (2.0.7): Downloading (100%)
  - Installing fzaninotto/faker (v1.9.1): Downloading (60%)PHP Fatal error:  Out of memory (allocated 14680064) (tried to allocate 2097184 bytes) in phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php on line 599

Fatal error: Out of memory (allocated 14680064) (tried to allocate 2097184 bytes) in phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php on line 599

And I expected this to happen:

composer self-update --rollback
composer clearcache
composer install
/tmp/blog [0] $ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 32 installs, 0 updates, 0 removals
  - Downloading fzaninotto/faker (v1.9.1)
  - Downloading hamcrest/hamcrest-php (v2.0.0)
  - Downloading mockery/mockery (1.4.0)
  - Downloading nunomaduro/collision (v4.2.0)
  - Downloading webmozart/assert (1.8.0)
  - Downloading phpdocumentor/reflection-common (2.1.0)
  - Downloading phpdocumentor/type-resolver (1.1.0)
  - Downloading phpdocumentor/reflection-docblock (5.1.0)
  - Downloading phpunit/php-token-stream (3.1.1)
  - Downloading sebastian/version (2.0.1)
  - Downloading sebastian/type (1.1.3)
  - Downloading sebastian/resource-operations (2.0.1)
  - Downloading sebastian/recursion-context (3.0.0)
  - Downloading sebastian/object-reflector (1.1.1)
  - Downloading sebastian/object-enumerator (3.0.3)
  - Downloading sebastian/global-state (3.0.0)
  - Downloading sebastian/exporter (3.1.2)
  - Downloading sebastian/environment (4.2.3)
  - Downloading sebastian/diff (3.0.2)
  - Downloading sebastian/comparator (3.0.2)
  - Downloading phpunit/php-timer (2.1.2)
  - Downloading phpunit/php-text-template (1.2.1)
  - Downloading phpunit/php-file-iterator (2.0.2)
  - Downloading theseer/tokenizer (1.1.3)
  - Downloading sebastian/code-unit-reverse-lookup (1.0.1)
  - Downloading phpunit/php-code-coverage (7.0.10)
  - Downloading doctrine/instantiator (1.3.1)
  - Downloading phpspec/prophecy (v1.10.3)
  - Downloading phar-io/version (2.0.1)
  - Downloading phar-io/manifest (1.0.3)
  - Downloading myclabs/deep-copy (1.9.5)
  - Downloading phpunit/phpunit (8.5.5)
  - Installing fzaninotto/faker (v1.9.1): Extracting archive
  - Installing hamcrest/hamcrest-php (v2.0.0): Extracting archive
  - Installing mockery/mockery (1.4.0): Extracting archive
  - Installing nunomaduro/collision (v4.2.0): Extracting archive
  - Installing webmozart/assert (1.8.0): Extracting archive
  - Installing phpdocumentor/reflection-common (2.1.0): Extracting archive
  - Installing phpdocumentor/type-resolver (1.1.0): Extracting archive
  - Installing phpdocumentor/reflection-docblock (5.1.0): Extracting archive
  - Installing phpunit/php-token-stream (3.1.1): Extracting archive
  - Installing sebastian/version (2.0.1): Extracting archive
  - Installing sebastian/type (1.1.3): Extracting archive
  - Installing sebastian/resource-operations (2.0.1): Extracting archive
  - Installing sebastian/recursion-context (3.0.0): Extracting archive
  - Installing sebastian/object-reflector (1.1.1): Extracting archive
  - Installing sebastian/object-enumerator (3.0.3): Extracting archive
  - Installing sebastian/global-state (3.0.0): Extracting archive
  - Installing sebastian/exporter (3.1.2): Extracting archive
  - Installing sebastian/environment (4.2.3): Extracting archive
  - Installing sebastian/diff (3.0.2): Extracting archive
  - Installing sebastian/comparator (3.0.2): Extracting archive
  - Installing phpunit/php-timer (2.1.2): Extracting archive
  - Installing phpunit/php-text-template (1.2.1): Extracting archive
  - Installing phpunit/php-file-iterator (2.0.2): Extracting archive
  - Installing theseer/tokenizer (1.1.3): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Extracting archive
  - Installing phpunit/php-code-coverage (7.0.10): Extracting archive
  - Installing doctrine/instantiator (1.3.1): Extracting archive
  - Installing phpspec/prophecy (v1.10.3): Extracting archive
  - Installing phar-io/version (2.0.1): Extracting archive
  - Installing phar-io/manifest (1.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.9.5): Extracting archive
  - Installing phpunit/phpunit (8.5.5): Extracting archive
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Warning:  Module 'readline' already loaded in Unknown on line 0
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
43 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

@gmponos I understand where you are coming from , but AFAICS, that’s not the problem here. For that particular build, there is one-non-dev dependency which hasn’t had a release since 2016 and one-dev dependency which is at dev-master and there is no conflict between the two.

I just ran into the same thing and upgrading to Composer 2.0 isn’t an option as the project uses a Composer plugin which isn’t compatible (yet) with Composer 2.0.

After some trial and error, largely based on info from when the CI build was still passing, I’ve found that doing a composer self-update 1.9.3 fixes it for us.

I haven’t analyzed which version of Composer introduced the error between 1.9.3 and the last 1.x release, but hopefully this info may help someone else running into this.

You can run the commands with --profile to get more info about memory usage.