]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stconn: don't wake up an applet waiting on buffer allocation
authorWilly Tarreau <w@1wt.eu>
Tue, 30 Apr 2024 06:38:18 +0000 (08:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 30 Apr 2024 19:36:47 +0000 (21:36 +0200)
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.

src/stconn.c

index 621d51e42952789037024394d19b9609e7420aca..f6d20ea4f65cc98513885c188aaba1ebe408686d 100644 (file)
@@ -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;
 }