[jifty-devel] MySQL: Transparent reconnect

Thomas Themel themel at blackwhale.net
Wed Sep 6 01:55:34 EDT 2006


Hi,
Jesse Vincent (jesse at bestpractical.com) wrote on 2006-09-06:
> > [Tue Sep 05 10:18:29 2006] [error] [client 85.124.169.111] FastCGI:
> > server "/home/www/ql.themel.com/bin/jifty" stderr: DBD::mysql::st execute 
> > failed: MySQL server has gone away at 
> > /usr/local/share/perl/5.8.4/Jifty/DBI/Handle.pm line 468.
> 
> Are you using FastCGI or jifty in standalone mode? If the latter, I
> think the problem is that HTTP::Server::Simple::CGI doesn't set
> GATEWAY_INTERFACE, so the clever magic you describe never kicks in. 

That's from a fastcgi setup, though the problem also existed on the
previous installation that used Apache's mod_proxy and jifty server.

> > DBD::mysql actually has a transparent reconnect feature that it disables
> > by default, unless the environment variables MOD_PERL or
> > GATEWAY_INTERFACE are set. It can be turned on by setting
> > $db->{mysql_auto_reconnect} = 1 ; It would be really useful for me to
> > have this in Jifty. After a quick look at the source, I didn't see an
> > obvious hook to change the initialization of Jifty::DBI::Handle::mysql
> > objects, and so I thought I'd ask whether
> > 
> > - Jifty should set GATEWAY_INTERFACE, at least in fastcgi mode?
> 
> In FastCGI mode, the CGI engine should do this. What webserver are you
> running on?

This is Apache2 set up according to the docs in Jifty::Script::FastCGI.
A quick look at /proc/<pid>/environ shows that the environment for Jifty
is completely empty except for the single JIFTY_COMMAND=fastcgi from the
-initial-env specification. I've added a second -initial-env parameter
to set GATEWAY_INTERFACE=fastcgi, which seems to work well enough,
though I'm not sure about the side effects.

ciao,
-- 
[*Thomas  Themel*] "In a word, strictly following the informal rules
[extended contact]  that we apply to such situations, they are
[info provided in] 'compatible' and you are an 'asshole'."
[*message header*]           - Theo de Raadt to DJB on openbsd-ports


More information about the jifty-devel mailing list