From: Willy Tarreau Date: Wed, 5 Feb 2014 17:31:24 +0000 (+0100) Subject: BUG/MEDIUM: checks: immediately report a connection success X-Git-Tag: v1.5-dev23~176 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3be293f4a3f466b71ddde639690b91979c9498a5;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: checks: immediately report a connection success When no check type is configured (so the basic connection check), we want the connection success to be immediately reported. Unfortunately, it did not happen because in this case the connection is not registered for read nor for write, and the wake_srv() callback does not handle this case where no data transfer was requested. However, having option tcp-check hides this problem because the check type follows a different setup mode, by having check->type != 0 and the connection believing it must try to send data. The effect was that without any option, checks would succeed only at the end of the check interval. So let's just add the wake-up condition. This bug appeared with the recent polling changes, no backport is needed. As a workaround, using "option tcp-check" fixes the problem. --- diff --git a/src/checks.c b/src/checks.c index 80f0bc0d30..b195c73bf3 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1449,6 +1449,13 @@ static int wake_srv_chk(struct connection *conn) __conn_data_stop_both(conn); task_wakeup(check->task, TASK_WOKEN_IO); } + else if (!(conn->flags & (CO_FL_DATA_RD_ENA|CO_FL_DATA_WR_ENA|CO_FL_HANDSHAKE))) { + /* 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. + */ + task_wakeup(check->task, TASK_WOKEN_IO); + } if (check->result != CHK_RES_UNKNOWN) { /* We're here because nobody wants to handle the error, so we