Hello Michal, On Wed, Dec 11, 2019 at 03:46:11PM +0100, Michal Pasierb wrote: > Hello, > > I have situation where HAProxy receives a request but doesn't log it. I > would like to know if this is desired behaviour or this is an actual bug. > > To replicate this issue: > 1) create HAProxy config which doesn't disable http-keep-alive > 2) on backend server set http-keep-alive timeout to a low value of 2 seconds > 3) run a script which sends requests in a loop and waits say 1.996 seconds > between each iteration > > >From time to time, there will be no response from HAProxy. This is > understandable. Connecting directly to backend server, without using > HAProxy, gives same result. This is all desired. > > However, there is no log indicating that HAProxy was processing a request > and that it failed on server side. > > This issue has already been discussed at > https://discourse.haproxy.org/t/haproxy-1-7-11-intermittently-closes-connection-sends-empty-response-on-post-requests/3052/5 > > I understand this configuration is clearly wrong because the timeout on > server should be higher than on HAProxy. In this scenario, I'm responsible > for HAProxy configuration and somebody else is responsible for > configuration of servers in backends. I can not know if every server is > correctly configured therefore I would like to enable logging of such > requests.
I see what you mean, and in fact it's on purpose and we even had to write code explicitly for this. The reason is that as you identified, sometimes the server closes at the same moment we send the request. But this must not be an error (and is not), it's just a matter of normal keep-alive behavior. In this case we silently forward the close to the client to act exactly like the server and let the client try again. I remember that in early 1.5 before we did this, some users complained that their monitoring was erratically reporting errors that didn't affect users because they were such keep-alive timeout issues. I must admit I hardly see what better solution we can propose at this point in order to satisfy everyone :-/ What sounds logical to most seems to be that only processed requests are logged which means that these ones would rather be ignored. Just my two cents, Willy

