From 4ac49287182dfefc69e7088332348ea0948022fa Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 17 Oct 2017 16:33:46 +0200 Subject: [PATCH] BUG/MINOR: stream-int: don't set MSG_MORE on SHUTW_NOW without AUTO_CLOSE Since around 1.5-dev12, we've been setting MSG_MORE on send() on various conditions, including the fact that SHUTW_NOW is present, but we don't check that it's accompanied with AUTO_CLOSE. The result is that on requests immediately followed by a close (where AUTO_CLOSE is not set), the request gets delayed in the TCP stack before being sent to the server. This is visible with the H2 code where the end-of-stream flag is set on requests, but probably happens when a POLL_HUP is detected along with the request. The (lack of) presence of option abortonclose has no effect here since we never send the SHUTW along with the request. This fix can be backported to 1.7, 1.6 and 1.5. --- src/stream_interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stream_interface.c b/src/stream_interface.c index 93772119d3..a5bd3edf16 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -655,7 +655,8 @@ static void si_conn_send(struct connection *conn) if ((!(oc->flags & (CF_NEVER_WAIT|CF_SEND_DONTWAIT)) && ((oc->to_forward && oc->to_forward != CHN_INFINITE_FORWARD) || - (oc->flags & CF_EXPECT_MORE))) || (oc->flags & CF_SHUTW_NOW)) + (oc->flags & CF_EXPECT_MORE))) || + ((oc->flags & (CF_AUTO_CLOSE|CF_SHUTW_NOW)) == (CF_AUTO_CLOSE|CF_SHUTW_NOW))) send_flag |= CO_SFL_MSG_MORE; if (oc->flags & CF_STREAMER) -- 2.39.5