Skip to content

drush deploy disregards php's memory_limit parameter #4899

Description

@jcnventura

Describe the bug
Deploying a site using drush deploy is showing me out-of-memory errors even though I'm running it with the following command line:
php -d memory_limit=-1 vendor/bin/drush deploy.

To Reproduce
Execute php -d memory_limit=-1 vendor/bin/drush deploy.

Expected behavior
Drush would not run out of memory, and finish deploying the site.

Actual behavior
Drush ran out of memory at PHP's configured memory limit.

Workaround
Instead of running drush deploy, run the following set of commands in sequence:

php -d memory_limit=-1 vendor/bin/drush updatedb --no-cache-clear
php -d memory_limit=-1 vendor/bin/drush cache:rebuild
php -d memory_limit=-1 vendor/bin/drush config:import
php -d memory_limit=-1 vendor/bin/drush cache:rebuild
php -d memory_limit=-1 vendor/bin/drush deploy:hook

However, this defeats the purpose of having the deploy command. Also it transfers the burden of what exactly the deploy command does back to my CI deploy script.

System Configuration

Q A
Drush version? 10.3.6
Drupal version? 9.2.7
PHP version 7.4.25
OS? Linux

Additional information
I believe the problem here is that even though the drush deploy command is indeed running in an unlimited memory environment, drush is starting new scripts that do not inherit the memory_limit setting from the deploy command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions