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?

Thank you in advance for your help!
Ludovico

Here is my haproxy configuration:
global
        log /dev/log    local2
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin
        stats timeout 30s
        user haproxy
        group haproxy
        daemon

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        timeout connect 5s
        timeout client  700s
        timeout client-fin 30s
        timeout server  700s
        timeout tunnel 72h

listen http-internal
        bind 10.A.B.C:80
        mode http
        cookie SERVERID insert nocache indirect
        option http-keep-alive
        option forwardfor
        option redispatch
        option abortonclose
        capture request header X-Real-IP len 50
        default_backend user


backend user
        balance hdr(User-Agent)
        hash-type consistent
        mode http
        server serverC01 10.A.B.X:80 check
        server serverC01 10.A.B.Y:80 check


[1] http://permalink.gmane.org/gmane.comp.web.haproxy/3862

Reply via email to