This might be an issue that doesn''t come up in a normal LAMP setup.
One of the things that MySQL is really fast at is opening and closing
connections, which is why the standard paradigm in PHP is for each
page request that requires database access to open its own connection
and close it down when the request is over.
FastCGI changes this paradigm because it keeps the DB connection open
for a long time and services many hundreds of requests with a single
thread without closing the connection. My guess is that some fastcgi
threads are hanging around during a period of inactivity, the DB
connection times out without them noticing, and they suddenly get new
requests and try to service them with the same DB connection. I''m not
very familiar with the innards of fastcgi, but there is probably an
option to tweak thread lifetimes. I bet if you make sure that the
MySQL connection timeout is longer than the fastcgi thread lifetime,
you''ll be okay.
On Sun, 24 Oct 2004 10:50:58 -0400, Garrett Rooney
<rooneg-lmTtMILVy1hYyNfobJ4H94tnbWQYyvPC@public.gmane.org>
wrote:> Henning Koch wrote:
>
>
> > Hello,
> >
> > I have a rails application running with FastCGI. Every
> > few hours, the application exits with a
> > "Broken pipe - /tmp/mysql.sock" error whenever it needs
> > to access the database.
> >
> > Restarting Apache fixes this, but only for another few
> > hours.
> >
> > Any help would be greatly appreciated.
> >
> > - Henning
> >
>
> That sounds like MySQL is closing the connection eventually, and you
> need to force a reconnect. I''m not sure exactly how to do that
though.
>
> -garrett
>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>