BUG/MEDIUM: checks: Don't attempt to read if we destroyed the connection.
In event_srv_chk_io(), only call __event_srv_chk_r() if we did not subscribe
for reading, and if wake_srv_chk() didn't return -1, as it would mean it
just destroyed the connection and the conn_stream, and attempting to use
those to recv data would lead to a crash.
This should be backported to 1.9 and 2.0.
diff --git a/src/checks.c b/src/checks.c
index d3920ce..a1fe015 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -716,10 +716,11 @@
struct check *check = ctx;
struct conn_stream *cs = check->cs;
struct email_alertq *q = container_of(check, typeof(*q), check);
+ int ret = 0;
if (!(check->wait_list.events & SUB_RETRY_SEND))
- wake_srv_chk(cs);
- if (!(check->wait_list.events & SUB_RETRY_RECV)) {
+ ret = wake_srv_chk(cs);
+ if (ret == 0 && !(check->wait_list.events & SUB_RETRY_RECV)) {
if (check->server)
HA_SPIN_LOCK(SERVER_LOCK, &check->server->lock);
else