In both of these files:

  • hostmaster.alias.drushrc.php
  • hm.alias.drushrc.php

...the drush_aliases array fills up with the same line over and over as time goes on. I'm not sure why, but if the array gets large enough, Verify tasks on hostmaster lead to out-of-memory errors:

2017/01/03 02:59:42 [error] 22216#22216: *135 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes) in /var/aegir/hostmaster-7.x-3.9-beta1/profiles/hostmaster/modules/aegir/hosting/task/hosting_task.module on line 1245" while reading response header from upstream, client: 192.0.142.71, server: aegir.dev.example.com, request: "GET /hosting/task/361 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "aegir.dev.example.com", referrer: "http://aegir.dev.example.com/hosting/c/hostmaster"
2017/01/03 03:01:07 [error] 22216#22216: *142 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes) in /var/aegir/hostmaster-7.x-3.9-beta1/profiles/hostmaster/modules/aegir/hosting/task/hosting_task.module on line 1245" while reading response header from upstream, client: 192.0.142.71, server: aegir.dev.example.com, request: "GET /hosting/task/361 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "aegir.dev.example.com"
2017/01/03 03:01:18 [error] 22216#22216: *144 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /var/aegir/hostmaster-7.x-3.9-beta1/profiles/hostmaster/modules/aegir/hosting/task/hosting_task.module on line 1198" while reading response header from upstream, client: 192.0.142.71, server: aegir.dev.example.com, request: "GET /hosting/task/361 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "aegir.dev.example.com"
2017/01/03 03:01:42 [error] 22216#22216: *154 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/aegir/hostmaster-7.x-3.9-beta1/profiles/hostmaster/modules/aegir/hosting/task/hosting_task.module on line 1198" while reading response header from upstream, client: 192.0.142.71, server: aegir.dev.example.com, request: "GET /hosting/task/361 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "aegir.dev.example.com", referrer: "http://aegir.dev.example.com/hosting/c/hostmaster"

The array eventually looks like:

  'drush_aliases' =>  array (
    0 => 'hm',
    1 => 'hm',
    2 => 'hm',
    3 => 'hm',
    [...]
  ),

As a workaround, I've been editing each of the files manually, and reducing the size of the array leaving only the first item.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

colan created an issue. See original summary.

helmo’s picture

Strange, I don't see more then one line on various servers.

helmo’s picture

Assigned: Unassigned » colan
Status: Active » Postponed (maintainer needs more info)

Are you still seeing this? Any pattern between servers that show this and servers that don't?

colan’s picture

I think it happens on hostmaster verify tasks, but not consistently. Still trying to nail it down. Will report back when I have something.

colan’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active

Okay, so it's definitely happens when verifying the hostmaster site. I'm seeing this in the task. The bolded portion is what keeps repeating many times. Is there something somewhere that would be causing this to loop?

Where's the code that actually adds items to the alias array, and what calls it?

Every time a verify task runs, an exponentially higher number of items get added.

  • [...]
  • Calling hook drush_provision_save
  • Loaded alias @hostmaster from file /var/aegir/.drush/hostmaster.alias.drushrc.php
  • Template loaded from Provision Config class Provision_Config_Drushrc_Alias: /usr/share/drush/commands/provision/Provision/Config/Drushrc/provision_drushrc_alias.tpl.php
  • Changed permissions of /var/aegir/.drush/hostmaster.alias.drushrc.php to 640
  • Generated config in write(): Drush configuration file (/var/aegir/.drush/hostmaster.alias.drushrc.php)
  • Changed permissions of /var/aegir/.drush/hostmaster.alias.drushrc.php to 440
  • Loaded alias @hm from file /var/aegir/.drush/hm.alias.drushrc.php
  • Template loaded from Provision Config class Provision_Config_Drushrc_Alias: /usr/share/drush/commands/provision/Provision/Config/Drushrc/provision_drushrc_alias.tpl.php
  • Changed permissions of /var/aegir/.drush/hm.alias.drushrc.php to 640
  • Generated config in write(): Drush configuration file (/var/aegir/.drush/hm.alias.drushrc.php)
  • Changed permissions of /var/aegir/.drush/hm.alias.drushrc.php to 440
  • Template loaded from Provision Config class Provision_Config_Drushrc_Alias: /usr/share/drush/commands/provision/Provision/Config/Drushrc/provision_drushrc_alias.tpl.php
  • Changed permissions of /var/aegir/.drush/hm.alias.drushrc.php to 640
  • Generated config in write(): Drush configuration file (/var/aegir/.drush/hm.alias.drushrc.php)
  • Changed permissions of /var/aegir/.drush/hm.alias.drushrc.php to 440
  • [...]
colan’s picture

With this patch, I can treat the symptom, but I'd still like to figure out where these arrays get populated to fix this at the source.

helmo’s picture

LOL, your patch in #6 looks ok.

colan’s picture

Status: Active » Needs review

Okay, thanks. Let's just go with that then.

helmo’s picture

Status: Needs review » Reviewed & tested by the community
helmo’s picture

Status: Reviewed & tested by the community » Fixed

  • helmo committed 874d094 on 7.x-3.x authored by colan
    Issue #2840531 by colan: Hostmaster alias array eventually leads to out-...
helmo’s picture

Status: Reviewed & tested by the community » Fixed
helmo’s picture

Status: Fixed » Needs work

Hmm, this now gives warnings on a platform verify.

For sites we initialize it in Provision/Context/site.php but we don't in Provision/Context/platform.php ... we don't have a use for platform aliases right?

We could add an extra set of if's in ./Provision/Config/Drushrc/Alias.php or move the initialization up to Provision/Context.php

array_unique() expects parameter 1 to be array, null given Alias.php:22

  • colan committed 25259af on 7.x-3.x
    Issue #2840531 by helmo, colan: Ensure we're dealing with arrays before...
colan’s picture

Status: Needs work » Fixed

Worked in my tests. This should do it.

colan’s picture

Status: Fixed » Closed (fixed)

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