Re: Timeouts when all backends are down

From: Benoit <max.maverick#maverick.eu.org>
Date: Tue, 23 Sep 2008 07:34:10 +0200


Willy Tarreau a écrit :
> Hi Alexander,
>
> On Mon, Sep 22, 2008 at 02:37:17PM +0200, Alexander Staubo wrote:
>
>> I have this configuration:
>>
>> defaults
>> errorfile 504 .../timeout.html
>> contimeout 60s
>> clitimeout 15s
>> srvtimeout 60s
>> retries 3
>>
>> Yet when all backends are down (ie., not being connectable), the
>> timeout page is shown almost immediately. I would expect HAProxy to
>> retry for 60s and then fail with the timeout page. What am I doing
>> wrong?
>>
>
> You're not doing anything wrong. It is simply that haproxy knows that
> your servers are down because they have been checked and detected as
> such. So once it receives a request and has no way to serve it, it
> immediately returns "503 service unavailable". If they have not yet
> been detected as down, but they simply reject connections, it does
> not need to wait for nothing to happen, so it first retries on the
> same server one second later (after a "turn-around" state), until the
> retries count expires. Then it finally tries another server if the
> redispatch option is enabled.
>
> You should really see the "contimeout" as what it is, ie a timeout.
> It triggers when haproxy tries to connect to a server, and this
> server does not accept nor reject the connection. Typically one which
> has been unplugged, or on a remote site, etc... That's why I recommend
> to keep contimeout values low (about 4-5 seconds, to cover at least one
> TCP retransmit).
>
> Willy
>
> (PS: I have not lost your two other mails, just did not have time to respond yet)
>

I just had a weird problem on a similar subject, all my backend came to fail due to a database problem and so haproxy's frontend went up and down.

However i was expecting it to reply with my local custom 503 http page:  

  errorloc 500 /etc/haproxy/my-errors/500.http
  errorloc 502 /etc/haproxy/my-errors/502.http
  errorloc 503 /etc/haproxy/my-errors/503.http
  errorloc 504 /etc/haproxy/my-errors/504.http

But instead i got some GET on the backends with the /etc/haproxy/my-errors/503.http uri:
xxx.xxx.xx.xx - - [23/Sep/2008:03:36:35 +0200] "GET /etc/haproxy/my-errors/503.http HTTP/1.1" 404 345 "-"

And a generic 503 page on the client side. Received on 2008/09/23 07:34

This archive was generated by hypermail 2.2.0 : 2008/09/23 07:45 CEST