I get a variation on the fatal error message below after running drush en several times with different modules.

I can get around the problem by logging out of my shell and back in again. Seems like a memory leak that accumulates with each iteration of drush en.

The affected modules seem to be enabled despite the error most of the time, but not all.

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 88 bytes) in /home7/enviroc1/public_html/drupal/includes/menu.inc on line 3468
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Allowed memory size of 67108864 bytes exhausted (tried to
allocate 88 bytes) in
/home7/enviroc1/public_html/drupal/includes/menu.inc, line 3468

Comments

moshe weitzman’s picture

Category: bug » support
Status: Active » Fixed

Thats just Drupal being Drupal. Please increase your memory limit in the php.ini thats in effect for cli requests. The exact location of that php.ini is returned by 'drush status`

ryan_courtnage’s picture

Version: All-versions-4.x-dev » 7.x-4.5
Category: support » bug
Status: Fixed » Active

Hi Moshe,
There is definitely something up with version 4.5 of Drush. I've been using a Drush 4.4 script to install my site for months. My script uses "drush site-install" followed by a "drush en" (and the long list of modules my site uses).

With Drush 4.4, I can monitor the php process and see that it peaks at about 50MB of memory usage (the most memory is consumed while running "drush en", and this is understandable).

With Drush 4.5, the php process just starts eating up memory while enabling modules, which ultimately ends in an "Error: Allowed memory size of 134217728 bytes exhausted". That's with a 128MB memory_limit. Even at 256MB I can't install my site.

Reverted back to Drush 4.4 and everything is fine again.

carole’s picture

I got this on an update of 15 modules with tons of DB updates, and I couldn't tell if rerunning updatedb fixed them all (I got a white screen afterwards). I'm still debugging 10 hours later. Reverting to 4.4.

carole’s picture

I ran pear install drush/drush-4.4.0. It said it worked, but my drush status says it's 4.5.
1) There's an error in the install
2) Do I have to delete it & reinstall manually? I remember a ton of config issues (perhaps that was on the Windows box), I hope there are none on debian

downloading drush-4.4.0.tgz ...
Starting to download drush-4.4.0.tgz (249,761 bytes)
....................................................done: 249,761 bytes
install ok: channel://pear.drush.org/drush-4.4.0
# drush status
Drush version : 4.5

mollyavalon’s picture

I'm having the same problem. The php.ini file (that I don't have permission to edit on the university server) specifies 32M.

I bumped up the memory to 256M in ~/.drush/drush.ini, ~/public_html/php.ini, ~/public_html/mysubfolder/.htaccess, and ~/public_html/mysubfolder/sites/default/settings.php.

I get the out of memory error with drush cc.

greg.1.anderson’s picture

@mollyavalon: per #1, run drush status to see the exact location of the php.ini file you'll need to edit.

mollyavalon’s picture

Sorry not to get back sooner.

drush status tells me it's using /usr/local/lib/php.ini. I'm on shared hosting and can't edit that file.

In ~/drush/drush.ini, I set memory to 256M, which matches ~/public_html/php.ini, which is reflected in my Drupal status report.

I though perhaps ~/.drush/drush.ini was being ignored, but I ran this from my drupal folder (thanks to my colleague Paul), which told me it was finding drush.ini.

strace drush &> ~/drush.trace

drush status runs. I can download with drush.

drush cc gives me this:

Fatal error: Out of memory (allocated 45613056) (tried to allocate 436734 bytes) in /home/mysite/public_html/mydrupalfolder/includes/cache.inc on line 337
Drush command terminated abnormally due to an unrecoverable error.

drush en omega gives me this:

Fatal error: Out of memory (allocated 46399488) (tried to allocate 122880 bytes) in /home/mysite/public_html/mydrupalfolder/sites/all/modules/quicktabs/quicktabs.admin.inc on line 257
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Out of memory (allocated 46399488) (tried to allocate 122880
bytes) in
/home/mysite/public_html/mydrupalfolder/sites/all/modules/quicktabs/quicktabs.admin.inc,
line 257

drush up gives me this:

Fatal error: Out of memory (allocated 46399488) (tried to allocate 143 bytes) in /home/mysite/public_html/mydrupalfolder/sites/all/modules/page_title/page_title.admin.inc on line 28
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Out of memory (allocated 46399488) (tried to allocate 143
bytes) in
/home/mysite/public_html/mydrupalfolder/sites/all/modules/page_title/page_title.admin.inc,
line 28

Any ideas for the next troubleshooting step?

mollyavalon’s picture

I ran
drush php-eval "phpinfo()" | grep memory
per this issue, and it says memory_limit => 256M => 256M.

Because I was getting out of memory errors, I assumed it wasn't seeing that I have memory set to 256M in drush.ini and in my settings.php file. But it DOES see it.

Is 256M not normally enough?

If it's something else, what could it be? I'm crippled without drush!

ryan_courtnage’s picture

@mollyavalon, please try using Drush 4.4. I suspect it will make your memory problems go away, and will reaffirm that 4.5 introduced the problem.

You can download 4.4 via this link:
http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz

mollyavalon’s picture

Oh, I was so hopeful! I replaced drush 4.5 with 4.4, but I'm still getting the error. Here's what I got from drush cc:

Fatal error: Out of memory (allocated 45613056) (tried to allocate 78 bytes) in /home/mysite/public_html/mydrupalfolder/includes/cache.inc on line 405
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Out of memory (allocated 45613056) (tried to allocate 78 bytes)
in /home/mysite/public_html/mydrupalfolder/includes/cache.inc, line 405

So I went to another drupal installation I have in this same ~/public_html folder, ran drush cc, and it did not fail.

Maybe this is not a drush issue. I'll keep looking.

dwalker51’s picture

I backed up my home/drush directory
downloaded 4.4 from http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz
gunzipped and untarred in /home
ran drush status, it came out as 4.4, and since I had previously updated my site i just did a drush up, it showed if I wanted to upgrade to 4.5

A newer version of drush, 7.x-4.5, is available. You are currently running drush version 4.4; to update, run `drush self-update`. To disable this check, put "$options['self-update'] = FALSE;" in your drushrc.php configuration file.

Unfortunately I am still getting the error with 128MB of mem in my php.ini

r.n(130) drush en skinr_panels, skinr, skinr_ui
The following extensions will be enabled: skinr, skinr_panels, skinr_ui
Do you really want to continue? (y/n): y
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /uext10/www/noao/includes/menu.inc on line 351
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /uext10/www/noao/includes/menu.inc, line 351

moshe weitzman’s picture

Category: bug » support
Status: Active » Fixed

your drupal is comsuming all available memory. you need to increase memory_limit in the php.ini. use `drush status` to find its location and make a change in a drush.ini if you can't edit php.ini

mollyavalon’s picture

I asked our server folks to increase our memory in the php.ini file shown in drush status. It's set at 256M there and also in drush.ini.

Still getting errors like this one resulting from drush cc 1 (all)

Fatal error: Out of memory (allocated 46137344) (tried to allocate 512 bytes) in /home/devlsiku/public_html/devd7upmh/includes/file.inc on line 2033
Drush command terminated abnormally due to an unrecoverable error.                               [error]
Error: Out of memory (allocated 46137344) (tried to allocate 512 bytes) in
/home/devlsiku/public_html/devd7upmh/includes/file.inc, line 2033
greg.1.anderson’s picture

n.b. 46137344 > 256M

mollyavalon’s picture

True enough. But I am puzzling over why Drupal is functioning fine and drush is not, and this is my only indicator.

dwalker51’s picture

Changed /root/.drush/php.ini to 256M from 128M, this was the file that drush was using and not /etc/php.ini, the memory error has gone away, not quite sure why it needs so much though....

drush status
Drupal version : 7.12
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : drupal_user
Database name : noao
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : noao
Administration theme : seven
PHP configuration : /root/.drush/php.ini
Drush version : 4.5
Drush configuration :
Drush alias files :
Drupal root : /home/www/noao
Site path : sites/default
File directory path : sites/default/files
Private file directory path : sites/default/files/intranet

ahmedhanyfawzy’s picture

If you are on the shared host and you configured correctly the php.ini for higher memory_limit then the solution is very simple you just need to copy the 'correct' php.ini to the installation folder of drush ; and drush will pick it up by default the next time it run , more details here.

Anonymous’s picture

A lot of shared hosts limit php memory usage to 32, 48 or 64Mb.
In such cases, your changes to you php.ini or drush.ini files settings won't allow you to pass that limit.

In my humble opinion, 64Mb is a huge amount of memory and should be more than enough for any site without real memory consuming tasks like image editing.
Unfortunately the world (and especially PHP?) is not ideal, which causes Drupal and Drush to load (in some cases) about any available .php file for a single page, whether needed or not.
This consumes a lot of memory and I can't keep but wondering whether this is really necessary.
I love Drupal and Drush as a system, but keep running into memory limits if I try to add a module to many. That's also may main reason to stick with Drupal-6.x for now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ambient.impact’s picture

Version: 7.x-4.5 » 7.x-5.4
Status: Closed (fixed) » Active

Hi there. My admin recently updated PHP to 5.3.13 and I started to get this exact fatal error without fail. Drush is now unusable. We've tried upping the PHP memory limit to 256M, to no avail. We've tried downgrading 5.4 to 4.4, which made no difference. We're at our wit's end with this. Has anyone got any clues as to how we might work around this? Much appreciated.

juc1’s picture

I am having the 'out of memory' problem in Drush 5.4 - is there any news? Is there any command which displays the current memory limit for Drush?

greg.1.anderson’s picture

drush ev 'print(ini_get("memory_limit"));'

-1 means "no limit".

juc1’s picture

@ greg - thanks I get

# drush ev 'print(ini_get("memory_limit"));'
256M 

but I am getting

Fatal error: Out of memory (allocated 69730304) (tried to allocate 7680 bytes) in /home/.../sites/all/modules/views/modules/node/views_handler_field_node_link.inc on line 32

I am trying to follow the solution suggested above in #17 =

1) Know where you drush runs from by issuing the command :
which drush

2) Copy the 'correct' php.ini to the installation folder of your drush :
cp php.ini /home2/egyptjoo/www/drfiles/drush/

Any clues please on where I can find the 'correct' php.ini?

Thanks

greg.1.anderson’s picture

For php.ini: http://bit.ly/NoXZFm

The link quoted in #17 does not appear to be exactly correct. Drush looks for its custom php.ini file, if any in ~/.drush.

juc1’s picture

Loaded Configuration File /usr/local/lib/php.ini

Like #7 above this is shared hosting so I can't see this file. # 17 above seems to say copy the php.ini file to another location so can I do this in the command line if I can't see the file? I have also tried copying /drush/examples/example.drush.ini to drush/drush.ini but that doesn't seem to help.

Thanks

greg.1.anderson’s picture

Priority: Major » Normal
Status: Active » Fixed

I can't support crippled hosting plans. You could try to construct a new php.ini from the information from phpinfo(), or use a php.ini from a local machine and hope for the best. Ask for support with your ISP or switch providers. See resources page for providers that support Drush pre-installed.

juc1’s picture

@ Greg my hosting plan's php.ini memory limit is 256MB so how is it crippled? I thought the problem here was that Drush was for some reason ignoring php.ini and taking a lower limit from somewhere else. Anyway would it help to ask my host for a copy of the php.ini file that I can't see and then copy this file somewhere in my Drush folder?

Thanks

greg.1.anderson’s picture

If your hosting provider won't let you read files you need, then you should ask them for support; the Drush issue queue is not the place for this sort of question.

juc1’s picture

@ Greg I don't follow what you mean by this "If your hosting provider won't let you read files..."

I will try to rephrase: This installation of Drush is on shared hosting - this means that I don't have root access and can't see some files such as php.ini. I expect that my host would send me the relevant php.ini if I asked, but I am first asking here is copying this php.ini file to my Drush folder likely to help with the Drush memory problem?

Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

vacho’s picture

Version: 7.x-5.4 » 7.x-5.8

I had the same problem.
A shared server, I copied php.ini with memory_limit = 256M, I copied within Drush and within your site folder, I've also tried to modify the file drush.ini memory_limit.

Until there all told me I was using in memory_limit 256M but still drush with memory problems.

Finally I found this solution:
1. Having php.ini with memory_limit = 256M in the site folder (public_html or www)
2. Modify memory_limit = 256M in drush.ini file within Drush folder (if you have not copy from the examples folder: example.drush.ini)
3. Enable the use of this guideline in the. Htaccess

<IfModule mod_suphp.c>
  suPHP_ConfigPath / home / [account] / public_html
</ IfModule>

and with it all right!
I hope they serve

soliyappan’s picture

I am having this error in my site

Allowed memory size of 134217728 bytes exhausted (tried to allocate 25 bytes) public_html/includes/menu.inc

please any one help me to solve this. Thanks in advance..