]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: hlua: Report to SC when output data are blocked on a lua socket
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Jul 2025 14:09:20 +0000 (16:09 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 24 Jul 2025 10:06:48 +0000 (12:06 +0200)
It is a fix similar to the previous one ("BUG/MEDIUM: hlua: Report to SC
when data were consumed on a lua socket"), but for the write side. The
writer must notify the cosocket it needs more space in the request buffer to
produce more data by calling sc_need_room(). Otherwise, there is nothing to
prevent to wake the cosocket applet up again and again.

This patch must be backported as far as 2.8, and maybe to 2.6 too.

src/hlua.c

index c05b42fa548a3fd6389c88207dcb598e9e3b43d0..72e3d2140f74e059c867f82e08cd5548fd1c0ec4 100644 (file)
@@ -3232,6 +3232,7 @@ hlua_socket_write_yield_return:
                WILL_LJMP(luaL_error(L, "out of memory"));
        }
        xref_unlock(&socket->xref, peer);
+       sc_need_room(sc, channel_recv_max(&s->req) + 1);
        MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_socket_write_yield, TICK_ETERNITY, 0));
        return 0;
 }