Comment 7 for bug 551130

Revision history for this message
Joe Holloway (jholloway7) wrote : Re: infinite loop in /etc/init/mysql.conf if mysqld is not running.

In the old /etc/init.d/mysql script, there was a similar "check status" loop, but it only spun 14 times before exiting. If there were a problem with your server, you'd only block for max of ~14 seconds while trying to ping the server before breaking out.

    for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
        sleep 1
        if mysqld_status check_alive nowarn ; then break; fi
        ...
    done
    ...

In the new `upstart` script /etc/init/mysql.conf, the analogous status check was changed to a "while ! ..." loop which means the script will spin forever when your server has a problem?

    while ! /usr/bin/mysqladmin --defaults-file=$HOME/debian.cnf ping
    do
        sleep 1
    done

It seems that there are a few common errors that are easily resolvable, for example "Can't connect to MySQL server through socket '/var/run/mysqld/mysqld.sock'" error or issues with the debian-sys-maint user that some of us have from time-to-time, but there appears to be a chicken/egg scenario here caused by this infinite loop.

As a side note, I've now completely lost my /etc/init/mysql.conf file and can't seem to get it back through the package manager regardless of purging/reinstalling packages. That concerns me a bit, but I can't pinpoint the behavior well enough to log a separate bug at this point.