]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: Don't bother subscribing if we have a connection error.
authorOlivier Houchard <cognet@ci0.org>
Thu, 28 Mar 2019 16:32:42 +0000 (17:32 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 28 Mar 2019 16:32:42 +0000 (17:32 +0100)
In __event_srv_chk_r() and __event_srv_chk_w(), don't bother subscribing
if we're waiting for a handshake, but we had a connection error. We will
never be able to send/receive anything on that connection anyway, and
the conn_stream is probably about to be destroyed, and we will crash if
the tasklet is waken up.
I'm not convinced we need to subscribe here at all anyway, but I'd rather
modify the check code as little as possible.

This should be backported to 1.9.

src/checks.c

index 118ec6bf4430cd83d9ed6f7dc461d163291c4fd6..35744c6b78c5df545aa49b343869f6791451b764 100644 (file)
@@ -753,7 +753,8 @@ static void __event_srv_chk_w(struct conn_stream *cs)
                goto out_wakeup;
 
        if (conn->flags & CO_FL_HANDSHAKE) {
-               cs->conn->mux->subscribe(cs, SUB_RETRY_SEND, &check->wait_list);
+               if (!(conn->flags & CO_FL_ERROR))
+                       cs->conn->mux->subscribe(cs, SUB_RETRY_SEND, &check->wait_list);
                goto out;
        }
 
@@ -838,7 +839,8 @@ static void __event_srv_chk_r(struct conn_stream *cs)
                goto out_wakeup;
 
        if (conn->flags & CO_FL_HANDSHAKE) {
-               cs->conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
+               if (!(conn->flags & CO_FL_ERROR))
+                       cs->conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list);
                goto out;
        }