From: Willy Tarreau Date: Tue, 3 Apr 2018 17:31:38 +0000 (+0200) Subject: BUG/MINOR: checks: check the conn_stream's readiness and not the connection X-Git-Tag: v1.9-dev1~327 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2500fc2c3443f69bc05de53d0516da373d2f0cc1;p=thirdparty%2Fhaproxy.git BUG/MINOR: checks: check the conn_stream's readiness and not the connection Since commit 9aaf778 ("MAJOR: connection : Split struct connection into struct connection and struct conn_stream."), the checks use a conn_stream and not directly the connection anymore. However wake_srv_chk() still used to verify the connection's readiness instead of the conn_stream's. Due to the existence of a mux, the connection is always waiting for receiving something, and doesn't reflect the changes made in event_srv_chk_{r,w}(), causing the connection appear as not ready yet, and the check to be validated only after its timeout. The difference is only visible when sending pure TCP checks, and simply adding a "tcp-check connect" line is enough to work around it. This fix must be backported to 1.8. --- diff --git a/src/checks.c b/src/checks.c index cae2e3e3fa..8e4bc2ccf1 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1394,7 +1394,7 @@ static int wake_srv_chk(struct conn_stream *cs) __cs_stop_both(cs); task_wakeup(check->task, TASK_WOKEN_IO); } - else if (!(conn->flags & (CO_FL_XPRT_RD_ENA|CO_FL_XPRT_WR_ENA|CO_FL_HANDSHAKE))) { + else if (!(conn->flags & CO_FL_HANDSHAKE) && !(cs->flags & (CS_FL_DATA_RD_ENA|CS_FL_DATA_WR_ENA))) { /* we may get here if only a connection probe was required : we * don't have any data to send nor anything expected in response, * so the completion of the connection establishment is enough.