In mysql_service.inc, the grant_host function shell call will "freeze" if the database allow anonymous connections.

Since the 'mysql -u intntnllyInvalid' call won't fail, the shell_exec call will never return and thus the processing freeze (And for a strange reason consume all available memory sometime)

Here's the trace of the execution:

sh-4.1$ /var/aegir/drush/drush --debug @hostmaster provision-install 
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 7.71 MB]              [bootstrap]
Loading drushrc "/var/aegir/hostmaster-0.4-alpha14/drushrc.php" into "drupal" scope.    [bootstrap]
[0.04 sec, 7.72 MB]
Initialized Drupal 6.19 root directory at /var/aegir/hostmaster-0.4-alpha14 [0.05 sec,     [notice]
8.97 MB]
Found command: provision-install (commandfile=provision) [0.06 sec, 8.96 MB]            [bootstrap]
Initializing drush commandfile: drush_make [0.06 sec, 8.97 MB]                          [bootstrap]
Initializing drush commandfile: drush_make_d_o [0.06 sec, 8.97 MB]                      [bootstrap]
Initializing drush commandfile: provision [0.06 sec, 8.97 MB]                           [bootstrap]
Load alias @server_master [0.06 sec, 8.99 MB]                                              [notice]
Loading mysql driver for the db service [0.06 sec, 9.01 MB]                                [notice]
Loading apache driver for the http service [0.06 sec, 9.02 MB]                             [notice]
Load alias @platform_hostmaster [0.06 sec, 9.03 MB]                                        [notice]
Including /var/aegir/.drush/provision/db/install.provision.inc [0.06 sec, 9.05 MB]      [bootstrap]
Including /var/aegir/.drush/provision/dns/install.provision.inc [0.06 sec, 9.05 MB]     [bootstrap]
Including /var/aegir/.drush/provision/example/install.provision.inc [0.06 sec, 9.06 MB] [bootstrap]
Including /var/aegir/.drush/provision/http/install.provision.inc [0.06 sec, 9.06 MB]    [bootstrap]
Including /var/aegir/.drush/provision/platform/install.provision.inc [0.06 sec, 9.07 MB][bootstrap]
Function ereg_replace() is deprecated db.drush.inc:74 [0.06 sec, 9.11 MB]                  [notice]
Executing: mysql -u intntnllyInvalid -h 'speedup.dorsal.polymtl.ca' -P '3306' [0.06 sec,   [notice]
9.12 MB]

Comments

greenscientist’s picture

I'm currently trying to change the line 91 to:
$command = sprintf('echo "quit" | mysql -u intntnllyInvalid -h %s -P %s',

which add an echo "quit" as input to the mysql command.
It seems to work, but need more testing...

Anonymous’s picture

Yes this is bad.

It at least used to fail and exit with that spectacular error 'Dummy connection failed to fail.'

greenscientist’s picture

I've attached a patch which try the connection with a direct mysql_connect call.
This is less error prone than an exec call.

anarcat’s picture

Status: Active » Needs work

Great idea! This is exactly what I thought we should do.

However, you need to parse the error message and return the same match as we do in the commandline form, otherwise everything breaks down beyond that. I believe that the purpose of this function is to find the address of the server we're connecting from, as seen from the mysql server, so that functionality is very important.

Otherwise +1 on the patch once that is fixed.

adrian’s picture

you cant do this

the exec call may be calling the command on a remote web server, to determine what the grant needs to be for the webserver to access the db server.

greenscientist’s picture

Ok, I see your point.

Finally, simply adding -e "" to the mysql seem to be doing the trick.

anarcat’s picture

Status: Needs work » Needs review

That patch seems sound, I'll see if I can test this quickly to get it into the next release.

anarcat’s picture

Status: Needs review » Fixed

I tested an install with the patch, and it works, so that's good enough for me, pushing to master.

Welcome to the project, Yannick! :)

Status: Fixed » Closed (fixed)

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