Re: [request-tracker-maintainers] Bug#595054: request-tracker3.8: Race condition between RT3.8+apache2 and MySQL when booting by insserv
On Tue, Aug 31, 2010 at 04:06:28PM -0500, Matt Zagrabelny wrote:
>> Okay, there are two possible resolutions to this problem which spring
>> to mind:
>> * Arrange for database servers to start before Apache
>> I'm not sure if this is feasible, but it seems to me that it's likely
>> to be generally correct, given the layering implicit in database + web
>> * Arrange for RT to be more robust when a connection to the database fails
>> This is certainly something worth exploring, but is likely to be a rather
>> involved fix; not something I relish at this stage of the release cycle
>> (diverging from upstream). Then again, perhaps changing Apache or MySQL
>> (and the other database servers) would be more disruptive :)
>> I've added the CC because I'm not sure where to start discussing
>> whether the Apache/MySQL ordering can be changed. I had a look at
>> Policy (which doesn't seem to mention dependency based booting at all;
>> surely an inconsistency if it is to be enabled for squeeze?) and
>> <http://wiki.debian.org/LSBInitScripts> which leads me to think that
>> Apache needs something like "Should-Start: $database_server", but this
>> is mainly guessing. I would appreciate input from those familiar with
>> this part of the Debian infrastructure.
> Perhaps for /etc/init.d/mysql-server (or whatever it is called)
> # X-Start-Before: apache2
> # X-Stop-After: apache2
> I would think that it would be innocuous if apache2 was not installed.
> Is there a way to reference the virtual package httpd in the LSB
Well, these are valid comments, but I dislike these solutions, and here's
why: RT can be served by different HTTP servers (as an example, I've seen
a request in BTS for not depending on apache as several people are serving
RT using lighttpd) and, in turn, Apache is a very generic HTTP server.
Also, RT can use different database backends, and MySQL is nothing
special to RT in this regard; again, in turn, MySQL is a generic DBMS.
This means neither MySQL nor Apache, as packaged in Debian, should be
concerned about each other via their init-scripts, for instance, the idea
that apache2 init script should hint insserv that it should be started after
DB server is flawed: what about people serving purely static content with
their apache instance?
What is really needed, is a way to hint insserv (or whatever system will
come to replace it, be it upstart or systemd or whatever trendy thing at
the time for squeeze+N) about peculiar inter-package dependencies on a
package by package basis without hardcoding this to init scripts.
I can imagine some sort of /etc/insserv.d, in which a package could
place a file with some explicit rule about how it wants to start up.
Then the debconf for RT could construct such a file based on what the
user is selected as the HTTP server and as the DB server.
That way, in a normal setup the insserv would pick whatever boot order
in wants; when an RT is happened to be configured to run with apache2
and mysql, its debconf could hint insserv that apache2 now depends on
mysql booted first to start successfully. Should the user switch her DB
backend to pg, the explicit rule would be replaced; same thing if she
opts to change the HTTP server.
Unfortunately, I'm a relative old-timer and I'm facing a system like
insserv for the first time, so I lack expertise with it.
Hence it would be cool if some folks related to insserv could comment
on the idea presented above.
And yes, the idea that RT could use a DB server running on another host,
and hence RT should not prevent apache from starting if that server is
not available, is of course valid.