Haproxy with TIME_WAIT problem

Hi, I am using Haproxy 1.5.18 as load blancer. The architecture is like:

client( <—> haproxy( <—> backend server(

When the client initiates some short http post request, there would be a lot of TIME_WAIT found in haproxy. If the TIME_WAIT appears between the tcp connection between haproxy and backend server, it would be easy to understand. But I found that the TIME_WAIT existes in the connections between client and haproxy. So I traced the

packet stream through client to backend. I am more confused because I expected 4 handshake for each client<-> haproxy and haproxy<->backend connection broken. But there are only haproxy sending FIN to backend and client sending FIN to haproxy. I do not see the reverse. And I do not know why the tcp connection status between client and haproxy becoming TIME_WAIT.

Any comment would be appreciated. Thanks a lot.

I assume frame 98 contains the FIN from haproxy. As haproxy closes first, it’s socket goes into TIME_WAIT after the the connection is closed.

O~ Yes, it is. So it is the haproxy breaking the TCP connection between client and haproxy. Thank you very much!