BUG/MEDIUM: mux-h2: don't refrain from offering oneself a used buffer

Usually when calling offer_buffer(), we don't expect to offer it to
ourselves. But with h2 we have the same buffer_wait for the two directions
so we can unblock the recv path when completing a send(), or we can unblock
part of the mux buffer after sending the first few buffers that we managed
to collect. Thus it is important to always accept to wake up any requester.

A few parts of this patch could possibly be backported but earlier versions
already have other issues related to low-buffer condition so it's not sure
it's worth taking the risk to make things worse.
This commit is contained in:
Willy Tarreau 2019-05-29 17:50:48 +02:00
parent 7f1265a238
commit 201840abf1

View File

@ -428,7 +428,7 @@ static inline void h2_release_buf(struct h2c *h2c, struct buffer *bptr)
{
if (bptr->size) {
b_free(bptr);
offer_buffers(h2c->buf_wait.target, tasks_run_queue);
offer_buffers(NULL, tasks_run_queue);
}
}
@ -442,7 +442,7 @@ static inline void h2_release_mbuf(struct h2c *h2c)
count++;
}
if (count)
offer_buffers(h2c->buf_wait.target, tasks_run_queue);
offer_buffers(NULL, tasks_run_queue);
}
/* returns the number of allocatable outgoing streams for the connection taking
@ -2852,7 +2852,7 @@ static int h2_send(struct h2c *h2c)
}
if (released)
offer_buffers(h2c->buf_wait.target, tasks_run_queue);
offer_buffers(NULL, tasks_run_queue);
/* wrote at least one byte, the buffer is not full anymore */
h2c->flags &= ~(H2_CF_MUX_MFULL | H2_CF_DEM_MROOM);
@ -3062,7 +3062,7 @@ static struct task *h2_timeout_task(struct task *t, void *context, unsigned shor
}
if (released)
offer_buffers(h2c->buf_wait.target, tasks_run_queue);
offer_buffers(NULL, tasks_run_queue);
}
/* either we can release everything now or it will be done later once