Re: Apache translates 500 to 502 from haproxy

From: Sachin Shetty <sshetty#egnyte.com>
Date: Mon, 13 Jun 2011 16:11:33 +0000 (UTC)


Willy Tarreau <w <at> 1wt.eu> writes:

>
> On Fri, Jun 10, 2011 at 04:41:08PM +0530, Manoj Kumar wrote:
> > Hi,
> >
> > We are forwarding specific requests from apache to haproxy which
> > interbally forwards it to a pool of cherry py servers. We have seen that
> > certain requests end up in 500 in haproxy and cherry py logs which is ok
> > and understood, but apache instead sends a 502 to the client.
>
> Maybe for any reason apache is rejecting the response and aborting the
> connection, which might explain that message in your logs :
>
> > [Fri Jun 10 00:46:01 2011] [error] (103)Software caused connection
> > abort: proxy: pass request body failed to 192.168.2.100:9910
> > <http://192.168.2.15:9910/> (192.168.2.15)
>
> Willy
>
>

Hi Willy,

I spent some more time looking in to this, notice the error in apache log, it is parsing request body and not response

I think this is what is gong on:

  1. Apache receives a POST request
  2. Forwards to haproxy
  3. haproxy forwards to Cherrypy
  4. Cherrypy aborts the request due to some internal error, returns 401/500
  5. haproxy sends the response back to Apache and terminates the connection
  6. Apache however is still expecting somebody will read the posted response and barfs with pass request body failed error

Now this is definitely due to haproxy, since if I skip haproxy and make Apache hit cherrypy directly, I see a proper response code from Apache. I think haproxy is terminating the connection prematurely when the backend server returns and error status code

Any idea? Received on 2011/06/13 18:11

This archive was generated by hypermail 2.2.0 : 2011/06/13 18:30 CEST