]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: immediately report a connection success
authorWilly Tarreau <w@1wt.eu>
Wed, 5 Feb 2014 17:31:24 +0000 (18:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 5 Feb 2014 17:31:24 +0000 (18:31 +0100)
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.

src/checks.c

index 80f0bc0d309c26b78740f1eef96d053b53dedfd2..b195c73bf39009c435edb1d2fb824c9e3e70e76c 100644 (file)
@@ -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