Hi Ludovico,

On Fri, Apr 17, 2015 at 08:24:43PM -0700, Ludovico Cavedon wrote:
> Hi,
> 
> I am trying to find a solution to the following issue.
> 
> I have a client A that sends hundreds of HTTP requests per second to
> server B running ha-proxy 1.5.3.
> Server B/haproxy forwards them to server C.
> 
> Some of these request are long-polling: server C will receive the
> request and hang for a very long time (even hours potentially).
> Client A may decide to give up on long-polling request, close the
> connection and forget about it.
> However, haproxy will keep the connection state half-open, assuming
> the client is still there waiting for data.
> 
> On client A the connection state will go to FIN_WAIT2, and will be
> forgotten after 60 seconds.
> 
> After a while, client A will happen reuse the source port for a new
> connection, and send a SYN packet. On server B, however, the
> connection is still there in CLOSE_WAIT.
> 
> I am trying to find a way to avoid this from happening. Ideally I
> would like haproxy to close the connection completely if the client
> closes its side.
> "abortonclose" seemed the right option, but it looks like it works
> only if the FIN arrives before the connection to server C has not been
> established yet.
> 
> The statement from [1] sounded promising:
> > In 1.5 we have even improved that a bit further for users of long-polling
> > requests. When "option abortonclose" is set, if the client closes the send
> > side, then haproxy forwards this closing event to the server.
> 
> however it does not seem to happen in my case.
> 
> What am I doing wrong? Does it have to do with the fact that
> connection to server C are reused/persistent?
> Is there maybe a way to tell haproxy to close the client connection if
> there is no keepalive?

You're not necessarily doing anything wrong, it's fairly possible there's
a bug or an inconsistency between multiple options. I'll have to retry
here with your config, because the statement you quoted indeed indicates
that we should get a better behaviour. I won't do it immediately because
I'm still stuck fixing the things I recently broke before merging that
into 1.6.

In the mean time I would appreciate it if you could retry with 1.5.11 to
verify if you see the close being forwarded or not, because maybe it's due
to a bug that was fixed since 1.5.3.

Thanks,
Willy


Reply via email to