Re: timeout client / server clarification

From: Pedro Mata-Mouros Fonseca <pedro.matamouros#sapo.pt>
Date: Thu, 20 Aug 2009 18:30:10 +0100


Greetings Willy, everyone,

Had version 1.3.19, compiled from sources, and just upgraded to 1.3.20. The backend server that's being used for the upload is an Apache + mod_php. I've done the following in haproxy's configuration: set timeout client to 1s and timeout server to 8s. Started an image upload and after what seemed like 8 secs: "504 Gateway Time-out, The server didn't respond in time". I can see that the Apache PHP process keeps running and processes the upload, about one or two seconds after.

Taking into account your explanation of HAProxy's behavior, this is probably some misconfiguration on my side, either Apache or PHP, but I can't really see what could be the problem. It looks like Apache is not showing any activity until all the file has been sent by the client, which is strange because Apache should generate activity and the timeout server timer should be reset throughout the upload...

Can anyone shed some light on this?
Thanks so much.

Pedro.

On Aug 13, 2009, at 9:45 PM, Willy Tarreau wrote:

> On Thu, Aug 13, 2009 at 12:16:06PM +0100, Pedro Mata-Mouros Fonseca
> wrote:
>> Greetings,
>>
>> Picking this up again, there's a little problem. The directives
>> timeout client and timeout server should be set to the same value.
>> Imagine an upload scenario again. Imagine that both timeout
>> directives
>> are set to 8s (or 30s, or 120s, it doesn't really matter). Client
>> starts uploading and data is being sent to the server. Client timeout
>> counter is not reached because data is being sent, as John said
>> earlier. However, if uploading takes more than 8s (in this example),
>> the timeout server is swiftly activated...
>
> No, not at all. The timeout is reset each time there is activity.
> This means that during the upload from the client to the server,
> both timeouts are constantly refreshed. However, if the server
> suddenly stops reading the data, its timeout will eventually
> expire.
>
>> Any obvious way to go around this, aside from increasing the
>> timeouts?
>> I don't want to increase them because I don't really know how much
>> time an upload can take. I also know that a very obvious solution
>> would be to have all uploads go to a different domain and not pass by
>> HAProxy. Anyone dealt with this problem already?
>
> It's already OK. Try it. Some people on this list deal with uploads
> of gigabytes during more than one hour. So I'm pretty sure it's
> working
> OK. However, one old version (1.3.15.2 I think, but I may be wrong)
> had
> a bug which could cause what you describe. I don't think there are
> many
> such versions in the wild given that there have been 8 patches since.
>
> Willy
>
>
Received on 2009/08/20 19:30

This archive was generated by hypermail 2.2.0 : 2009/08/20 19:45 CEST