drush-ops / drush-launcher

A small wrapper around Drush for your global $PATH.
GNU General Public License v2.0
237 stars 50 forks source link

Huge memory use in drush launcher 0.8.0 (Out of memory kill during drush si) #82

Closed rfay closed 3 years ago

rfay commented 3 years ago

On Drupal 9.1.x, using drush launcher to run site-installed drush:

# Running 'drush si' to install drupal....
# 
# mmap() failed: [12] Cannot allocate memory
# 
# mmap() failed: [12] Cannot allocate memory
# 
# mmap() failed: [12] Cannot allocate memory
# PHP Fatal error:  Out of memory (allocated 4297068544) (tried to allocate 8589934600 bytes) in phar:///usr/local/bin/drush/.box/src/Printer.php on line 61

Why is drush launcher trying to use all that memory in Printer.php?

I think I can work around this in quicksprint by just running vendor/bin/drush, but had hoped not to see this kind of behavior change.

webflo commented 3 years ago

Could you try this with version https://github.com/drush-ops/drush-launcher/releases/tag/0.7.4?

rfay commented 3 years ago

This may be a drush 8.4.5 issue, trying to make a way to repro it.

Although it happens always in CI on quicksprint https://github.com/drud/quicksprint/pull/183 I'm having a hard time making it happen manually (even ssh-ing into circleci).

I thought that we were still composer-installing drush in quicksprint, but I guess the 8.4.x support for D9 let us remove that. So we're actually using drush launcher with drush 8 to do this drush si.

rfay commented 3 years ago

I have some answers.

  1. drush8 does the drush si just fine with no issues, so that's what I committed to fix this problem. See code
  2. drush launcher 0.7.4 also does just fine with no issues. I made a test PR to take a look, https://github.com/drud/quicksprint/pull/189
  3. drush launcher 0.8.0 results in the OOM kill every single time on both Linux and macOS (although somehow it doesn't on Windows, perhaps different terminal IO handling?). The test PR is https://github.com/drud/quicksprint/pull/188, and the failing test on CircleCI is https://app.circleci.com/pipelines/github/drud/quicksprint/175/workflows/df4ffdaf-8ff0-44a1-ba39-de974dad51a5/jobs/2919 - the test failure on macOS is identical. See the test and the failure reported in that test is
# drupal/drupal: This package is meant for core development,
#                and not intended to be used for production sites.
#                See: https://www.drupal.org/node/3082474
# 
# Running 'drush si' to install drupal....
# 
# mmap() failed: [12] Cannot allocate memory
# 
# mmap() failed: [12] Cannot allocate memory
# 
# mmap() failed: [12] Cannot allocate memory
# PHP Fatal error:  Out of memory (allocated 4297068544) (tried to allocate 8589934600 bytes) in phar:///usr/local/bin/drush/.box/src/Printer.php on line 61
# 
# Fatal error: Out of memory (allocated 4297068544) (tried to allocate 8589934600 bytes) in phar:///usr/local/bin/drush/.box/src/Printer.php on line 61
# Failed to execute command drush si --yes standard --account-pass=admin --db-url=mysql://db:db@db/db --site-name='Drupal Contribution Time': exit status 255
rfay commented 3 years ago

Updated results in https://github.com/drud/quicksprint/pull/188#issuecomment-728035488 using drush si -vvv

csandanov commented 3 years ago

I stumbled onto the same memory issue with 0.8.0, rollback to 0.7.4 resolved it

webflo commented 3 years ago

Found the bug. See https://github.com/box-project/box/issues/512

webflo commented 3 years ago

@rfay @csandanov fixed in https://github.com/drush-ops/drush-launcher/releases/tag/0.9.0

Thanks for the bug reports!

rfay commented 3 years ago

Glad you got it fixed, congratulations.