0
  • I am actually running Drupal on a LAMP (XUbuntu 20-04 with 4 GB RAM in VirtualBox)
  • At the beginning of the installation I had no problem with installing dependencies using composer
  • But since yesterday every composer command gets killed like in the following code (entity print installation):
igpde@igpde-VirtualBox:/var/www/html/d8igpde2$ composer require dompdf/dompdf
Using version ^0.8.6 for dompdf/dompdf
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Killed

  • I thought it could be a memory problem but in the php 7.4 client installation:
    • I read -1 should mean no limit
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = -1
  • Any Id how I could solve this problem?

Thanks in advance for you suggestions

  • Running with the vvv flag:
igpde@igpde-VirtualBox:/var/www/html/d8igpde2$ composer -vvv require dompdf/dompdf | tee composer.log
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/html/d8igpde2): git branch --no-color --no-abbrev -v
Executing command (/var/www/html/d8igpde2): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/var/www/html/d8igpde2): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/var/www/html/d8igpde2): hg branch
Executing command (/var/www/html/d8igpde2): fossil branch list
Executing command (/var/www/html/d8igpde2): fossil tag list
Executing command (/var/www/html/d8igpde2): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /home/igpde/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/html/d8igpde2/vendor/composer/installed.json
Loading plugin Drupal\Composer\Plugin\ProjectMessage\MessagePlugin
Loading plugin Drupal\Composer\Plugin\Scaffold\Plugin
Loading plugin Drupal\Console\Composer\Plugin\Extender
Loading plugin Composer\Installers\Plugin
Running 1.10.9 (2020-07-16 12:57:00) with PHP 7.4.3 on Linux / 5.4.0-42-generic
Downloading https://packages.drupal.org/8/packages.json
Writing /home/igpde/.cache/composer/repo/https---packages.drupal.org-8/packages.json into cache
Downloading https://repo.packagist.org/packages.json
Writing /home/igpde/.cache/composer/repo/https---repo.packagist.org/packages.json into cache
Reading /home/igpde/.cache/composer/repo/https---packages.drupal.org-8/drupal-provider-2020-3.json from cache
Reading /home/igpde/.cache/composer/repo/https---packages.drupal.org-8/drupal-provider-2020-2.json from cache
Reading /home/igpde/.cache/composer/repo/https---packages.drupal.org-8/drupal-provider-2020-1.json from cache
...............................................
Reading /home/igpde/.cache/composer/repo/https---repo.packagist.org/provider-sabberworm$php-css-parser.json from cache
Killed

  • the preceding output is very long
  • It waits a lot of time before declaring Killed. looks like a time out!
  • except for the last reading every Reading ... happens fast
5
  • 1
    Run it with the -vvv flag, you may get more info about the problem. Remember that “no limit” just means PHP won’t try to limit it - the machine can still have insufficient memory for the script to run regardless of that setting – Clive Sep 12 '20 at 13:36
  • We recently ran into this same issue. Someone reported that halting the virtual machine and powering up again solved this (after upping box memory to 4GB and php memory limit like you've done). – sonfd Sep 12 '20 at 13:50
  • Yes halting the Virtual Machine and powering up again make the command work Why ? I won't restart the Virtual Machine between each composer command. After powering up there was no other window opened other than the terminal – Jean-Pierre Mena Sep 12 '20 at 14:08
  • hi, did you try to give a bit more ram to VM? Composer shouldn't have issues but I think your virtual machine dies because a lot of files get changed and it simply can't handle it. – Ales Sep 12 '20 at 21:32
  • I don't know why halting and restarting solves it, I don't think you'll need to do it every time. I think it was more an issue of your new memory settings not taking effect, but rebooting the VM fixes that. – sonfd Sep 13 '20 at 11:54
2

You ran out of memory. This happens all the time with Composer.

Composer is a huge memory hog, especially when used with Drupal because of all the external interdependencies. And Drupal's requirements continue to grow with every new release, so the memory needed to use Composer with Drupal continues to grow. 4Gb of available memory should be enough, currently, but 2Gb is not enough in my experience. I find this problem can be avoided if you configure your system with sufficient swap space (2x physical memory is usually sufficient). This is for a development system of course - you won't be using Composer to install modules like that on a production system, you should be using a .lock file instead, so Composer's memory requirement will be much smaller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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