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.
This commit is contained in:
Olivier Houchard 2019-07-09 17:28:51 +02:00 committed by Olivier Houchard
parent 34ce7d075a
commit bc89ad8d94

View File

@ -716,10 +716,11 @@ static struct task *event_srv_chk_io(struct task *t, void *ctx, unsigned short s
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