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 10:17:34PM +0400, Konstantin Khomoutov wrote:
> I'm using RT 3.8 with apache2 via mod_perl, MySQL is used as a database
> backend. When the server is booted using insserv, apache2 starts long
> before MySQL and for some reason some bit of RT tries to access the
> MySQL server, times out and fails; this prevents apache2 from starting.
> DBI connect('dbname=rtdb;host=localhost','rtuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/perl5/DBIx/SearchBuilder/Handle.pm line 106
> [Tue Aug 31 21:40:18 2010] [error] Connect Failed Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)\n at /usr/share/request-tracker3.8/lib/RT.pm line 217\nCompilation failed in require at (eval 2) line 1.\n
> [Tue Aug 31 21:40:18 2010] [error] Can't load Perl file: /usr/share/request-tracker3.8/libexec/webmux.pl for server rt-admin.domain007.com:0, exiting...
> If I then start apache2 by hand, it starts OK (it only complains about
> the RTAddressRegexp config variable being unset which is harmless I suppose).
> I suspect the included "/etc/request-tracker3.8/apache2-modperl2.conf"
> file might be a culprit as otherwise I can't imagine what other code
> could call RT internals and make it access the DB backend.
Okay, there are two possible resolutions to this problem which spring
* 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.
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)