]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stats: Require more room if buffer is almost full
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 9 May 2023 14:31:01 +0000 (16:31 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 9 May 2023 14:36:45 +0000 (16:36 +0200)
This was lost with commit f4258bdf3 ("MINOR: stats: Use the applet API to
write data"). When the buffer is almost full, the stats applet gives up.
When this happens, the applet must require more room. Otherwise, data in the
channel buffer are sent to the client but the applet is not woken up in
return.

It is a 2.8-specific bug, no backport needed.

src/stats.c

index 0f2e027c165556da5713d75e61b4d3e26c4da0b4..dae6921fcae009da6e23b079abdcca78a0c9e535 100644 (file)
@@ -3228,12 +3228,16 @@ more:
                /* obj2 points to listeners list as initialized above */
                for (; ctx->obj2 != &px->conf.listeners; ctx->obj2 = l->by_fe.n) {
                        if (htx) {
-                               if (htx_almost_full(htx))
+                               if (htx_almost_full(htx)) {
+                                       sc_need_room(sc, htx->size / 2);
                                        goto full;
+                               }
                        }
                        else {
-                               if (buffer_almost_full(&rep->buf))
+                               if (buffer_almost_full(&rep->buf)) {
+                                       sc_need_room(sc, b_size(&rep->buf) / 2);
                                        goto full;
+                               }
                        }
 
                        l = LIST_ELEM(ctx->obj2, struct listener *, by_fe);
@@ -3294,12 +3298,16 @@ more:
                        srv_take(sv);
 
                        if (htx) {
-                               if (htx_almost_full(htx))
+                               if (htx_almost_full(htx)) {
+                                       sc_need_room(sc, htx->size / 2);
                                        goto full;
+                               }
                        }
                        else {
-                               if (buffer_almost_full(&rep->buf))
+                               if (buffer_almost_full(&rep->buf)) {
+                                       sc_need_room(sc, b_size(&rep->buf) / 2);
                                        goto full;
+                               }
                        }
 
                        if (ctx->flags & STAT_BOUND) {