zaporylie / composer-drupal-optimizations

Saves memory and CPU cycles when you run `composer update`
141 stars 16 forks source link

"Killed" shows up #25

Open slewazimuth opened 3 years ago

slewazimuth commented 3 years ago

While the undefined index item was corrected, all the sites I have on shared hosting are now showing "Killed" which means a memory issue. Turning up memory to 2G has no effect which is max permitted. I have fixed issue for the moment by switching composer to 2.0-dev and adding —ignore-platform-reqs to all composer require

Dakwamine commented 3 years ago

Same here. composer require and update do not work anymore on big projects.

zaporylie commented 3 years ago

This is with the plugin enabled or disabled (for the purpose of upgrading it)?

Dakwamine commented 3 years ago

Which plugin should I inspect its activation state? And how can I check the state of the plugin?

This is what has been loaded in the composer.lock:

{
            "name": "zaporylie/composer-drupal-optimizations",
            "version": "1.1.2",
            "source": {
                "type": "git",
                "url": "https://github.com/zaporylie/composer-drupal-optimizations.git",
                "reference": "0d6ebd8bc03679d312f99a1e4e950685dbf0ff18"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/zaporylie/composer-drupal-optimizations/zipball/0d6ebd8bc03679d312f99a1e4e950685dbf0ff18",
                "reference": "0d6ebd8bc03679d312f99a1e4e950685dbf0ff18",
                "shasum": ""
            },
            "require": {
                "composer-plugin-api": "^1.1"
            },
            "require-dev": {
                "composer/composer": "^1.6",
                "phpunit/phpunit": "^6"
            },
            "type": "composer-plugin",
            "extra": {
                "class": "zaporylie\\ComposerDrupalOptimizations\\Plugin"
            },
            "autoload": {
                "psr-4": {
                    "zaporylie\\ComposerDrupalOptimizations\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "GPL-2.0-or-later"
            ],
            "authors": [
                {
                    "name": "Jakub Piasecki",
                    "email": "jakub@piaseccy.pl"
                }
            ],
            "description": "Composer plugin to improve composer performance for Drupal projects",
            "time": "2020-10-06T10:41:00+00:00"
        },
Dakwamine commented 3 years ago

Here is the start of a verbose output:


root@3203d622731b:/var/www/html# composer update drupal/decoupled_router -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/html): git branch --no-color --no-abbrev -v
Executing command (/var/www/html): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/var/www/html): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/var/www/html): hg branch
Executing command (/var/www/html): fossil branch list
Executing command (/var/www/html): fossil tag list
Executing command (/var/www/html): svn info --xml
Reading /root/.composer/composer.json
Loading config file /root/.composer/composer.json
Reading /var/www/html/vendor/composer/installed.json
Reading /root/.composer/vendor/composer/installed.json
Loading plugin zaporylie\ComposerDrupalOptimizations\Plugin
Required tags were not explicitly set so the zaporylie/composer-drupal-optimizations set default based on project's composer.json content.
extra.commerce-drupal-optimizations.require.symfony/symfony: '>3.4'
Loading plugin OomphInc\ComposerInstallersExtender\Plugin
Loading plugin Drupal\Composer\Plugin\ProjectMessage\MessagePlugin
Loading plugin Drupal\Composer\Plugin\Scaffold\Plugin
Loading plugin Drupal\Console\Composer\Plugin\Extender
Loading plugin cweagans\Composer\Patches
Loading plugin Composer\Installers\Plugin
Running 1.10.13 (2020-09-09 11:46:34) with PHP 7.2.5 on Linux / 4.9.184-linuxkit
Gathering patches for root package.
Reading ./composer.lock
Loading composer repositories with package information
Downloading https://packages.drupal.org/8/packages.json
Writing /root/.composer/cache/repo/https---packages.drupal.org-8/packages.json into cache
Downloading https://repo.packagist.org/packages.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/packages.json into cache
Updating dependencies (including require-dev)
Reading /root/.composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2020-3.json from cache
Reading /root/.composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2020-2.json from cache

etc. until Killed or stalled execution.```
zaporylie commented 3 years ago

Plugin is active once it's installed and can be found in /vendor/zaporylie/composer-drupal-optimizations. I believe, since you've upgraded it to 1.1.2, you actually have it installed. That makes me think that what you're experiencing is some sort of performance regression. I'll look into it when I find the time.

EDIT: Your output confirmed that plugin is indeed active.

Required tags were not explicitly set so the zaporylie/composer-drupal-optimizations set default based on project's composer.json content.
extra.commerce-drupal-optimizations.require.symfony/symfony: '>3.4'
Dakwamine commented 3 years ago

I just noticed I forgot to greet you earlier. My apologies if it sounded rude. Thank you for your assistance.

Ok. I am digging to find workarounds until then.

Regarding the composer version, here is the output:


root@3203d622731b:/var/www/html# composer --version
Composer version 1.10.13 2020-09-09 11:46:34```
zaporylie commented 3 years ago

It's generally advised to run composer update and composer require commands on your local machine where usually you have more memory available. Once dependencies are resolved, commit the composer.lock and run composer install which is very efficient memory-wise compared to previously mentioned commands. In the meantime, I'll do my best to find out what caused the memory regression.

Dakwamine commented 3 years ago

Note: I am using docker on windows.

I confirm the composer update command works by increasing available memory to the docker engine (I have set it to 3 GB+) and removing services from the docker-compose.yml file which took some memory (elasticsearch + kibana).

The memory usage of the container peaked at 1.9GiB (10MiB when not running the command).