From 06f6811d9fc3f36597b686e4ca9fe7fbccf091b0 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 28 Mar 2019 17:32:42 +0100 Subject: [PATCH] BUG/MEDIUM: checks: Don't bother subscribing if we have a connection error. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/checks.c b/src/checks.c index 118ec6bf4..35744c6b7 100644 --- a/src/checks.c +++ b/src/checks.c @@ -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; }