Timeout client in TCP mode

Using HAProxy in TCP mode, if I enable timeout client, the TCP connection on client side is closed exactly after the timeout value, even if there is data passing inside the connection.

It looks like HAProxy always considers the connection idle, and does not recognize that traffic is passing. I need to proxy TCP traffic independent of the L7 protocol, as a stream of bytes.

My test is very simple, I’m using HAProxy in TCP mode with iperf3 as a client with below configuration.

    timeout connect 5s
    timeout client  5s
    timeout server  0s
    nbproc 1
    nbthread 2
listen l1
    mode tcp
    server s1

Sorry, I think I found the reason and it’s not caused by HAProxy: iperf uses two connections, one for control and the second for data. The control connection is used only at the beginning of the test and remains idle the rest of the time. So what is (correctly) closed by HAProxy is the control connection