Skip to content

MCLOUD-5818: Composer runs out of memory in container #191

@aepod

Description

@aepod

MCLOUD-5818: Composer can run out of memory when running in the CLI container

$ docker run -it  -v $(pwd):/app/ -v ~/.composer/:/root/.composer/ magento/magento-cloud-docker-php:7.3-cli-1.1 bash -c "composer require --dev sebastian/phpcpd phpmd/phpmd jakub-onderka/php-parallel-lint"
[ ok ] Starting enhanced syslogd: rsyslogd.
Using version ^5.0 for sebastian/phpcpd
Using version ^2.8 for phpmd/phpmd
Using version ^1.0 for jakub-onderka/php-parallel-lint
./composer.json has been updated
Loading composer repositories with package information                                Updating dependencies (including require-dev)

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

This is a pretty easy fix, CLI container simply needs an environment variable set.
COMPOSER_MEMORY_LIMIT=-1

Preconditions

  1. Magento 2.3.4
  2. Install a few packages, to get to the memory limit

Steps to reproduce

  1. Install Magento using composer
  2. Add enough composer requires to hit the limit

Expected result

  1. Should run without error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions