From: Willy Tarreau Date: Tue, 30 Apr 2024 06:38:18 +0000 (+0200) Subject: BUG/MINOR: stconn: don't wake up an applet waiting on buffer allocation X-Git-Tag: v3.0-dev10~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=072686dafd56c280347c344dcdd0fa76857599ae;p=thirdparty%2Fhaproxy.git BUG/MINOR: stconn: don't wake up an applet waiting on buffer allocation Since the extension of the buffers API to applets in 3.0-dev, an applet may find itself unable to allocate a buffer, and will block respectively on APPCTX_FL_OUTBLK_ALLOC or APPCTX_FL_INBLK_ALLOC depending on the direction. However the code in sc_applet_process() doesn't consider this situation when deciding to wake up an applet, so when the condition arises, the applet keeps ringing and is killed by the loop detector. The fix is trivial and simply consists in checking for the flags above. No backport is needed since this is new in 3.0. --- diff --git a/src/stconn.c b/src/stconn.c index 621d51e429..f6d20ea4f6 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -2309,7 +2309,8 @@ int sc_applet_process(struct stconn *sc) * appctx but in the case the task is not in runqueue we may have to * wakeup the appctx immediately. */ - if (sc_is_recv_allowed(sc) || sc_is_send_allowed(sc)) + if ((sc_is_recv_allowed(sc) && !applet_fl_test(__sc_appctx(sc), APPCTX_FL_OUTBLK_ALLOC)) || + (sc_is_send_allowed(sc) && !applet_fl_test(__sc_appctx(sc), APPCTX_FL_INBLK_ALLOC))) appctx_wakeup(__sc_appctx(sc)); return 0; }