1

This question already has an answer here:

Drush fails to execute any commands that result in changes. An error on this pattern is returned:

PHP Fatal error:  Out of memory (allocated 1223163904) (tried to allocate 130968 bytes) in C:\Users\*[username]*\AppData\Local\Composer\vendor\drush\drush\includes\filesystem.inc on line 361
Drush command terminated abnormally due to an unrecoverable error.                           [error]

Error: Out of memory (allocated 1223163904) (tried to allocate 130968 bytes) in C:\Users\*[username]*\AppData\Local\Composer\vendor\drush\drush\includes\filesystem.inc, line 361

Server is running Windows 2012R2, with Apache, PHP & MariaDB. Drush was installed on this server using Composer.

I've been able to adjust the memory allocation by placing the drushrc.php file in the root Drush folder (there's no '.drush' folder in a Composer install on Windows), but it doesn't resolve the issue. When I allocate 128M or 512M, the 'allocated' lines in the error showed all memory allocated; the error you see above, showing 1165M allocated, was returned after I increased the allocation to 2048M. I.e., it will allocate up to 1165M, and still return the error specifying a failure to allocate 130968 bytes (guessing that corresponds to 128M, though it doesn't seem to divide quite right).

So if I'm reading the error correctly, it seems to be telling me that it's already allocated [512M, 128M, or 1161M, depending], but is failing to allocate 128M.

512M appears to be the default; it's what's set in my base PHP.ini. Still haven't figured out where that 128M is being specified.

  1. Am I reading this error correctly? It's saying that it needs 128M, but it can't allocate it, because it's only got [some value much greater than 128M]?
  2. if so, what could be going on?
  3. has anybody seen this before? I haven't yet found a problem that looks like this. It's obviously not a case of Drush just running out of memory.
  4. are there any other places I could be looking for memory limits? I've accounted for the base php.ini, drush.ini, and drushrc.php.

Here's drush status output for this site:

Drupal version                :  7.37
Site URI                      :  http://default
Database driver               :  mysql
Database hostname             :  localhost
Database port                 :
Database username             :  [db username]
Database name                 :  [db name]
Drupal bootstrap              :  Successful
Drupal user                   :
Default theme                 :  bootstrap_gccverticalr01
Administration theme          :  seven
PHP executable                :  php.exe
PHP configuration             :  E:\php\php.ini
                         C:\Users\[username]\AppData\Local\Composer\vendor\drush\drush\drush.ini
PHP OS                        :  WINNT
Drush script                  :  C:\Users\[username]\AppData\Local\Composer\vendor\drush\drush\drush.php
Drush version                 :  7.0.0
Drush temp directory          :  C:\Users\[username]\AppData\Local\Temp
Drush configuration           :
Drush alias files             :
Install profile               :  standard
Drupal root                   :  E:\htdocs\newsdev
Site path                     :  sites/default
File directory path           :  sites/default/files
Private file directory path   :  sites/default/files/priv
Temporary file directory      :  c:\windows\temp
path

Per suggestion from @greg_t_anderson, here's a --debug on a module update:

E:\htdocs\newsdev>drush up name --debug
Starting Drush preflight. [0.34 sec, 2.41 MB]                                                      [preflight]
Loading drushrc "C:\Users\[username]\AppData\Local\Composer\vendor\drush\drush\drushrc.php" into      [bootstrap]
"drush" scope. [0.34 sec, 2.42 MB]

Cache HIT cid: 7.0.0-commandfiles-0-6fdbceb87a2d9ef0fd59b7f3a6ad6ecd [0.45 sec, 2.48 MB]               [debug]

Bootstrap to phase 0. [0.92 sec, 6.99 MB]                                                          [bootstrap]

Bootstrap to phase 6. [0.93 sec, 7 MB]                                                             [bootstrap]

Drush bootstrap phase : bootstrap_drupal_root() [0.94 sec, 7.37 MB]                                [bootstrap]

Initialized Drupal 7.37 root directory at E:\htdocs\newsdev [1.04 sec, 7.37 MB]                       [notice]

Find command files for phase 1 (max=6) [1.05 sec, 5.25 MB]                                             [debug]

Cache HIT cid: 7.0.0-commandfiles-1-4d4589c654b01ca711dc8471d98c0e08 [1.05 sec, 5.25 MB]               [debug]

Drush bootstrap phase : bootstrap_drupal_site() [1.07 sec, 5.26 MB]                                [bootstrap]

Initialized Drupal site default at sites/default [1.07 sec, 5.26 MB]                                  [notice]

Find command files for phase 2 (max=6) [1.17 sec, 5.26 MB]                                             [debug]

Cache HIT cid: 7.0.0-commandfiles-2-f17fc6bdab2f74278df75194ca483893 [1.17 sec, 5.26 MB]               [debug]

Drush bootstrap phase : bootstrap_drupal_configuration() [1.18 sec, 5.26 MB]                       [bootstrap]

Find command files for phase 3 (max=6) [1.18 sec, 5.27 MB]                                             [debug]

sql-query: SELECT 1; [1.19 sec, 5.39 MB]                                                              [status]

Executing: mysql --defaults-extra-file="C:\\Users\\[username]\\AppData\\Local\\Temp\\druFC47.tmp" --database=gccnewsdev --host=localhost --silent  < "C:\\Users\\[username]\\AppData\\Local\\Temp\\druFC46.tmp"
  1
Drush bootstrap phase : bootstrap_drupal_database() [1.3 sec, 5.39 MB]                             [bootstrap]

Successfully connected to the Drupal database. [1.31 sec, 5.93 MB]                                 [bootstrap]

Find command files for phase 4 (max=6) [1.31 sec, 5.93 MB]                                             [debug]

Drush bootstrap phase : bootstrap_drupal_full() [1.31 sec, 5.93 MB]                                [bootstrap]

Cache HIT cid: 7.0.0-install_profile-66ecfeb9791a023150773849f1550c5d [1.66 sec, 28.68 MB]             [debug]

Find command files for phase 5 (max=6) [1.66 sec, 28.68 MB]                                            [debug]

Cache HIT cid: 7.0.0-install_profile-66ecfeb9791a023150773849f1550c5d [1.66 sec, 28.68 MB]             [debug]

Cache HIT cid: 7.0.0-commandfiles-5-6046ef3049c5fa6ecece7eb50449dd57 [1.66 sec, 28.7 MB]               [debug]

Drush bootstrap phase : bootstrap_drupal_login() [1.69 sec, 29.35 MB]                              [bootstrap]

Find command files for phase 6 (max=6) [1.71 sec, 29.79 MB]                                            [debug]

Found command: pm-update (commandfile=pm) [1.71 sec, 29.79 MB]                                     [bootstrap]

Bootstrap to phase 6. [1.71 sec, 29.79 MB]                                                         [bootstrap]

Calling hook drush_pm_update [1.94 sec, 32.51 MB]                                                      [debug]

Bootstrap to phase 6. [1.94 sec, 32.55 MB]                                                         [bootstrap]

Loading release_info engine. [1.94 sec, 32.56 MB]                                                     [notice]

Loading version_control engine. [1.95 sec, 32.6 MB]                                                   [notice]

Loading package_handler engine. [1.95 sec, 32.62 MB]                                                  [notice]

Executing: wget --version
Loading update_status engine. [2.28 sec, 32.64 MB]                                                    [notice]

Including C:\Users\[username]\AppData\Local\Composer\vendor\drush\drush\commands\pm/updatecode.pm.inc [bootstrap]

[2.29 sec, 32.72 MB]
Calling hook drush_pm_updatecode_validate [2.29 sec, 32.81 MB]                                         [debug]

Returned from hook drush_pm_updatecode_validate [2.29 sec, 32.81 MB]                                   [debug]

Calling hook drush_pm_updatecode [2.29 sec, 32.83 MB]                                                  [debug]

Cache MISS cid: 7.0.0-alias-path--3435207224f9913394154572a229f036 [2.3 sec, 32.86 MB]                 [debug]

Backend invoke: php.exe                                                                              [command]

"C:\\Users\\[username]\\AppData\\Local\\Composer\\vendor\\drush\\drush\\drush.php" --php=php.exe
--backend=2 --verbose --debug --root="E:\\htdocs\\newsdev" --uri=http://default  pm-updatestatus
name 2>&1 [2.32 sec, 32.86 MB]
php.exe "C:\\Users\\[username]\\AppData\\Local\\Composer\\vendor\\drush\\drush\\drush.php"               [notice]

--php=php.exe  --backend=2 --verbose --debug --root="E:\\htdocs\\newsdev" --uri=http://default
pm-updatestatus name 2>&1 [2.32 sec, 32.87 MB]
Obtaining views_bulk_operations project path. [33.21 sec, 35.71 MB]                                    [debug]

Obtaining admin_menu project path. [33.21 sec, 35.72 MB]                                               [debug]

Obtaining advanced_help project path. [33.21 sec, 35.72 MB]                                            [debug]

Obtaining backup_migrate project path. [33.21 sec, 35.72 MB]                                           [debug]

Obtaining block_class project path. [33.21 sec, 35.72 MB]                                              [debug]

Obtaining ctools project path. [33.22 sec, 35.72 MB]                                                   [debug]

Obtaining cas project path. [33.22 sec, 35.73 MB]                                                      [debug]

Obtaining cas_attributes project path. [33.22 sec, 35.73 MB]                                           [debug]

Obtaining ckeditor project path. [33.22 sec, 35.73 MB]                                                 [debug]

Obtaining conditional_styles project path. [33.22 sec, 35.73 MB]                                       [debug]

Obtaining date project path. [33.22 sec, 35.73 MB]                                                     [debug]

Obtaining devel project path. [33.22 sec, 35.74 MB]                                                    [debug]

Obtaining entity project path. [33.23 sec, 35.74 MB]                                                   [debug]

Obtaining features project path. [33.23 sec, 35.74 MB]                                                 [debug]

Obtaining features_override project path. [33.23 sec, 35.74 MB]                                        [debug]

Obtaining feeds project path. [33.23 sec, 35.74 MB]                                                    [debug]

Obtaining feeds_tamper project path. [33.23 sec, 35.75 MB]                                             [debug]

Obtaining field_group project path. [33.28 sec, 35.75 MB]                                              [debug]

Obtaining field_permissions project path. [33.28 sec, 35.75 MB]                                        [debug]

Obtaining file_entity project path. [33.28 sec, 35.75 MB]                                              [debug]

Obtaining flickr project path. [33.28 sec, 35.75 MB]                                                   [debug]

Obtaining gccnews project path. [33.28 sec, 35.76 MB]                                                  [debug]

Obtaining hierarchical_select project path. [33.29 sec, 35.76 MB]                                      [debug]

Obtaining job_scheduler project path. [33.29 sec, 35.76 MB]                                            [debug]

Obtaining jquery_update project path. [33.29 sec, 35.76 MB]                                            [debug]

Obtaining ldap project path. [33.29 sec, 35.77 MB]                                                     [debug]

Obtaining libraries project path. [33.29 sec, 35.77 MB]                                                [debug]

Obtaining logintoboggan project path. [33.29 sec, 35.77 MB]                                            [debug]

Obtaining media project path. [33.29 sec, 35.77 MB]                                                    [debug]

Obtaining media_ckeditor project path. [33.3 sec, 35.77 MB]                                            [debug]

Obtaining media_oembed project path. [33.3 sec, 35.77 MB]                                              [debug]

Obtaining module_filter project path. [33.3 sec, 35.78 MB]                                             [debug]

Obtaining name project path. [33.3 sec, 35.78 MB]                                                      [debug]

Obtaining pathauto project path. [33.3 sec, 35.78 MB]                                                  [debug]

Obtaining pathologic project path. [33.3 sec, 35.78 MB]                                                [debug]

Obtaining redirect project path. [33.3 sec, 35.78 MB]                                                  [debug]

Obtaining respondjs project path. [33.31 sec, 35.79 MB]                                                [debug]

Obtaining rules project path. [33.31 sec, 35.79 MB]                                                    [debug]

Obtaining taxonomy_container project path. [33.31 sec, 35.79 MB]                                       [debug]

Obtaining taxonomy_csv project path. [33.31 sec, 35.79 MB]                                             [debug]

Obtaining taxonomy_manager project path. [33.36 sec, 35.79 MB]                                         [debug]

Obtaining taxonomy_menu_block project path. [33.36 sec, 35.8 MB]                                       [debug]

Obtaining token project path. [33.36 sec, 35.8 MB]                                                     [debug]

Obtaining views project path. [33.36 sec, 35.8 MB]                                                     [debug]

Obtaining workbench project path. [33.36 sec, 35.8 MB]                                                 [debug]

Obtaining workbench_access project path. [33.37 sec, 35.8 MB]                                          [debug]

Obtaining workbench_email project path. [33.37 sec, 35.81 MB]                                          [debug]

Obtaining workbench_media project path. [33.37 sec, 35.81 MB]                                          [debug]

Obtaining workbench_moderation project path. [33.37 sec, 35.81 MB]                                     [debug]

Obtaining bootstrap project path. [33.37 sec, 35.81 MB]                                                [debug]

Update information last refreshed: Sun, 05/10/2015 - 4:13pm
  1
  GNU Wget 1.11.4

  Copyright (C) 2008 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later
  <http://www.gnu.org/licenses/gpl.html>.
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

  Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
  Currently maintained by Micah Cowan <micah@cowan.name>.
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
  SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
  syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
 Name               Installed Version  Proposed version  Message
 Name Field (name)  7.x-1.9            7.x-1.10          Update available


Code updates will be made to the following projects: Name Field [name-7.x-1.10]

Note: A backup of your project will be stored to backups directory if it is not managed by a supported version control system.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue with the update process? (y/n): y
Starting to update Name Field code at sites/all/modules/name... [59.32 sec, 34.56 MB]                 [notice]

Verifying signature for svn version control engine. [59.32 sec, 34.58 MB]                              [debug]

Executing: svn info "E:\\htdocs\\newsdev/sites/all/modules/name"
  'svn' is not recognized as an internal or external command,
  operable program or batch file.
Verifying signature for bzr version control engine. [59.44 sec, 34.57 MB]                              [debug]

Executing: bzr root "E:\\htdocs\\newsdev/sites/all/modules/name"
  'bzr' is not recognized as an internal or external command,
  operable program or batch file.
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 130968 bytes) in C:\Users\[username]\AppData\Local\Composer\vendor\drush\drush\includes\filesystem.inc on line 361

I also watched the performance monitor while the Drush command was executing. The behavior is very different depending on how much memory is allocated in drushrc.php:

  • if memory is set to a moderate fixed amount (for this trace, it was set to 512M), memory usage barely changes, and CPU usage spikes to 100% for several seconds at three points in the process: when the PHP executable is loaded, and at two others later in the process that it was hard to pin down.
  • if memory is set to unlimited, memory usage rapidly maxes out (the VM is currently allocated 4GB) and CPU maxes to 100% for the entire processing time, dipping below only when I'm being prompted for input and at a few other points. Eventually the system will either drop the remote desktop connection or spontaneously reboot.

marked as duplicate by kenorb, Adrian Cid Almaguer, Scott Joudry, No Sssweat, Krishna Mohan Mar 17 '16 at 7:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Run a failing command with --debug, and see if it reveals any additional clues. – greg_1_anderson Dec 13 '15 at 0:03
  • just now I set the memory to unlimited (-1) and confirmed that Drush recognized the setting. Result: System rapidly maxed memory and CPU usage, and Drush failed with the same error. System was so heavily loaded that it forced a system reboot. I'll choke down the memory back to 512M and run again with debug as soon as I have the console back. – user1016793 Dec 13 '15 at 13:08
  • results w/ --debug at lower memory limit posted as an edit – user1016793 Dec 13 '15 at 13:44
  • So, clearly Drush is falling into an infinite loop on your system. All of the debug messages are completely normal up to the point where you receive the out-of-memory error. If this is really happening on any command, perhaps the error is somewhere in the drush post-command processing. To trace this down, you'll need to either set up a source-level debugger, or add additional debugging messages to Drush. – greg_1_anderson Dec 13 '15 at 15:05
  • how is the infinite loop causing the memory error? where in the drush code would that happen? – user1016793 Dec 13 '15 at 15:57
0

Since I don't have the time or resources to hack or debug Drush, I worked around it by removing and manually re-installing Composer, then installing Drush 8. The problem no longer manifests.

  • Hi. Since I had the same syntoms as in your question, I am sharing my solution. In my case I had memory_limit = 256M correctly se on /etc/php/7.0/apache2/php.ini file, but a memory_limit = 256MB (with unwanted "B" set in /etc/php/7.0/cli/php.ini file. Correcting that resolved the issue. Hope it can help someone other with this problem! – miro marchi May 8 '16 at 20:19

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