]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stream-int: don't set MSG_MORE on SHUTW_NOW without AUTO_CLOSE
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Oct 2017 14:33:46 +0000 (16:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 17 Oct 2017 14:38:21 +0000 (16:38 +0200)
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

index 93772119d3aed2fc33f2e766564361b4638b04eb..a5bd3edf165447ae64e30f3f4d8b50890e872688 100644 (file)
@@ -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)