]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: don't refrain from offering oneself a used buffer
authorWilly Tarreau <w@1wt.eu>
Wed, 29 May 2019 15:50:48 +0000 (17:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 29 May 2019 15:54:35 +0000 (17:54 +0200)
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

index c5a10dfce126622832977456202d2c370a87469c..e3c0bb0033ac2b94eb6daa6b6b842c22109c1ea4 100644 (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