Mongrel + Apache occasional Proxy Error

Hi There - long time reader first time poster :stuck_out_tongue:

I appreciate this is a problem with quite a few threads out there, but I
have read many of the threads and tried many of the fixes / hacks
suggested to no avail.

I have taken over looking after a server that is running 6 rails
applications, each with up to 3 mongrels each. The apps each use a local
mysql database.

Every few days or sometimes more frequently I get the infuriating error
from some of the apps:


Proxy Error

The proxy server recieved an invalid response from an upstream server.
The proxy could not handle the request GET /

Reason: Error reading from remote server


I have read many threads and tried adding the following to the vhost
file for each cluster:

<VirtualHost *>
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

This did not seem to solve the issue unfortunately. I have the mysql gem
installed (ver 2.7). When I log into mysql and run the “show full
processlist” there are a lot of SLEEP commands with a TIME value ranging
from 100 - 3000. It looks like there is one for each mongrel in each
cluster. I am not sure if this is normal behavior for the mysql gem? Is
there any way of finding out whether rails is using the mysql gem? Can
the gem be installed but rails still be using the ruby drivers instead
of the gem?

I am not even sure if it is a mysql issue, but mysql seems to be the
first port of call for fixing the proxy errors.

I have been banging y head against this for weeks now and am completely
out of ideas!

Any help would be most appreciated!

Key Info:

OS: CentOS 5
Apache: Apache/2.0.52
MySQL: Ver 14.7 Distrib 4.1.20 GEM: mysql (2.7)
Ruby: ruby 1.8.6
Rails rails (2.1.0, 1.2.4, 1.2.3) (Apps using 2.1.0)
Mongrel: 1.1.5

Thanks guys!