]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: spoe: Only skip sending new frame after a receive attempt
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 5 Jun 2023 06:15:59 +0000 (08:15 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 5 Jun 2023 06:24:34 +0000 (08:24 +0200)
When a SPOE appctx is processing frames in sync mode, we must only skip
sending a new frame if it is still waiting for a ACK frame after a receive
attempt. It was performed before the receive attempt. As a consequence, if
the ACK frame was received, the SPOE appctx did not try to process queued
messages immediately. This could increase the queue time and thus slow down
the processing time of the stream.

Thanks to Daniel Epperson for his help to diagnose the bug.

This patch must be backported to every stable versions.

src/flt_spoe.c

index 8d31780db71199b8e5ef15eb3a505c6819af8414..65f20cec19e162a58bb2faf6415441a268f80516 100644 (file)
@@ -1730,12 +1730,6 @@ spoe_handle_processing_appctx(struct appctx *appctx)
                      (agent->b.be->queue.length ||
                       (srv && (srv->queue.length || (srv->maxconn && srv->served >= srv_dynamic_maxconn(srv))))));
 
-       /* Don"t try to send new frame we are waiting for at lease a ack, in
-        * sync mode or if applet must be closed ASAP
-        */
-       if (appctx->st0 == SPOE_APPCTX_ST_WAITING_SYNC_ACK || (close_asap && SPOE_APPCTX(appctx)->cur_fpa))
-               skip_sending = 1;
-
        /* receiving_frame loop */
        while (!skip_receiving) {
                ret = spoe_handle_receiving_frame_appctx(appctx, &skip_receiving);
@@ -1756,6 +1750,12 @@ spoe_handle_processing_appctx(struct appctx *appctx)
                }
        }
 
+       /* Don"t try to send new frame we are waiting for at lease a ack, in
+        * sync mode or if applet must be closed ASAP
+        */
+       if (appctx->st0 == SPOE_APPCTX_ST_WAITING_SYNC_ACK || (close_asap && SPOE_APPCTX(appctx)->cur_fpa))
+               skip_sending = 1;
+
        /* send_frame loop */
        while (!skip_sending && SPOE_APPCTX(appctx)->cur_fpa < agent->max_fpa) {
                ret = spoe_handle_sending_frame_appctx(appctx, &skip_sending);