Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | provision-multiple_hm_aliases-2840531-6.patch | 616 bytes | colan |
Comments
Comment #2
helmo CreditAttribution: helmo at Initfour websolutions commentedStrange, I don't see more then one line on various servers.
Comment #3
helmo CreditAttribution: helmo at Initfour websolutions commentedAre you still seeing this? Any pattern between servers that show this and servers that don't?
Comment #4
colanI think it happens on hostmaster verify tasks, but not consistently. Still trying to nail it down. Will report back when I have something.
Comment #5
colanOkay, 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.
Comment #6
colanWith 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.
Comment #7
helmo CreditAttribution: helmo at Initfour websolutions commentedThat would be in http://cgit.drupalcode.org/provision/tree/Provision/Context/site.php#n48
And http://cgit.drupalcode.org/provision/tree/Provision/Config/Drushrc/Alias...
The hm alias is added in http://cgit.drupalcode.org/provision/tree/migrate.hostmaster.inc#n142 and http://cgit.drupalcode.org/provision/tree/install.hostmaster.inc#n253
A quick fix could be to filter out duplicates in write_alias()
Comment #8
helmo CreditAttribution: helmo at Initfour websolutions commentedLOL, your patch in #6 looks ok.
Comment #9
colanOkay, thanks. Let's just go with that then.
Comment #10
helmo CreditAttribution: helmo at Initfour websolutions commentedComment #11
helmo CreditAttribution: helmo at Initfour websolutions commentedComment #13
helmo CreditAttribution: helmo at Initfour websolutions commentedComment #14
helmo CreditAttribution: helmo at Initfour websolutions commentedHmm, 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
Comment #16
colanWorked in my tests. This should do it.
Comment #17
colan