From 201840abf121d3347fb284545ad88c47c814225d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 29 May 2019 17:50:48 +0200 Subject: [PATCH] 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. --- src/mux_h2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mux_h2.c b/src/mux_h2.c index c5a10dfce..e3c0bb003 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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