Closed LucasDemea closed 3 years ago
This works, but shouldn't this be set by default during provisioning ?
Just so I understand, Trellis would temporarily set the limit to "unlimited" during provisioning only? Then set it back to some same limit at the end of provisioning?
I believe the intention is to allow customizing memory_limit
for cli. See: #1278
Ohhh the limit for CLI 😄 missed that part
This works, but shouldn't this be set by default during provisioning ?
Just so I understand, Trellis would temporarily set the limit to "unlimited" during provisioning only? Then set it back to some same limit at the end of provisioning?
I meant that the php cli memory limit should be set when the php role is run. Either by setting it to a custom value, as https://github.com/roots/trellis/pull/1278 does, or by setting to -1 (if I understand well, by setting it to -1, php cli will take the same limit as defined in php.ini).
Trellis would temporarily set the limit to "unlimited" during provisioning only?
Actually, we need to solve this as well because:
TASK [wp-cli : Install WP-CLI packages] ****************************************
System info:
Ansible 2.10.5; Darwin
Trellis version (per changelog): "Migrate to Xdebug 3"
---------------------------------------------------
non-zero return code
Reverted composer.json.
WP-CLI ran out of memory. Please see https://bit.ly/wpclimem for further
help.
failed: [68.183.121.209] (item=typisttech/image-optimize-command:@stable) => {"ansible_loop_var": "item", "changed": true, "cmd": ["wp", "package", "install", "typisttech/image-optimize-command:@stable"], "delta": "0:00:01.892408", "end": "2021-03-15 09:51:13.638753", "item": "typisttech/image-optimize-command:@stable", "rc": 255, "start": "2021-03-15 09:51:11.746345", "stderr_lines": ["Reverted composer.json.", "WP-CLI ran out of memory. Please see https://bit.ly/wpclimem for further help."], "stdout": "Installing package typisttech/image-optimize-command (@stable)\nUpdating /home/web/.wp-cli/packages/composer.json to require the package...\nUsing Composer to install the package...\n---\nLoading composer repositories with package information\nUpdating dependencies\n\nFatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485760 bytes) in phar:///usr/bin/wp/vendor/composer/composer/src/Composer/Repository/ComposerRepository.php on line 588", "stdout_lines": ["Installing package typisttech/image-optimize-command (@stable)", "Updating /home/web/.wp-cli/packages/composer.json to require the package...", "Using Composer to install the package...", "---", "Loading composer repositories with package information", "Updating dependencies", "", "Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485760 bytes) in phar:///usr/bin/wp/vendor/composer/composer/src/Composer/Repository/ComposerRepository.php on line 588"]}
Maybe we can just set the CLI limit to -1
permanently? I think for the CLI context that might be fine.
+1, just ran into this today. Although the bedrock site got plenty of memory, the CLI doesn't. This is an issue especially with wp
CLI.
A PR setting the value to -1
would be welcome 😄
@swalkinshaw: https://github.com/roots/trellis/pull/1278 in combination with setting its default to -1
instead to php_memory_limit
?
Oh forgot about that, but yeah we need to hardcode php_cli_memory_limit
to -1
@swalkinshaw: Edit: https://github.com/roots/trellis/pull/1278#issuecomment-853287789
Description
(Following up on https://discourse.roots.io/t/cant-use-wp-cli-due-to-php-memory-limit/20257/5)
When installing a WP-CLI package by adding it to the wp_cli_packages ansible variable (but the issue could potentially happen with any other php command), I get a
Fatal error: Allowed memory size of 134217728 bytes exhausted
.I can get rid of the problem by setting the memory_limit to a higher value :
php -d memory_limit=512M "$(which wp)" package install git@github.com:10up/wp-vulnerability-scanner.git
But it's not an ideal solution.
I also tried setting php cli memory limit to -1 in
/etc/php/7.4/cli/php.ini
.This works, but shouldn't this be set by default during provisioning ?
Steps to reproduce
Run a command in the development VM , for example :
wp package install git@github.com:10up/wp-vulnerability-scanner.git
Expected behavior: Command works.
Actual behavior: Returns a PHP memory limit fatal error.
Versions
Trellis version : 1.7.1 Ubuntu 20.04