]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Report a send activity everytime data were sent
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Oct 2023 16:07:29 +0000 (18:07 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Oct 2023 08:35:32 +0000 (10:35 +0200)
When read/write timeouts were refactored in 2.8, we decided to change when a
send activity had to be reported. Before, everytime some data were sent a
send activity were reported. At this time, the channel's wex timer were
updated. During the refactoring, we decided to limit send activity to sends
that ampty te channel's buffer, consuming all outgoing data. Idea behind
this change was to protect haproxy against clients consumming data very
slowly.

However, it is too strict. Some congested muxes but still active can hit the
client or the server timeout. It seems a bit unfair. It is especially
visible with QUIC/H3 but it is probably also possible with H2 if the window
size is small.

The better is to restore the old behavior.

This patch must be backported to 2.8.

src/stconn.c

index eaf6d2b383553ca5e3e97b7e5f5303ab836c6325..fbfebc7a599ef03541afedaf740965944f564c53 100644 (file)
@@ -1691,6 +1691,11 @@ static int sc_conn_send(struct stconn *sc)
                oc->flags |= CF_WRITE_EVENT | CF_WROTE_DATA;
                if (sc->state == SC_ST_CON)
                        sc->state = SC_ST_RDY;
+               sc_ep_report_send_activity(sc);
+       }
+       else {
+               if (sc_state_in(sc->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO))
+                       sc_ep_report_blocked_send(sc);
        }
 
        if (!sco->room_needed || (did_send && (sco->room_needed < 0 || channel_recv_max(sc_oc(sc)) >= sco->room_needed)))
@@ -1704,13 +1709,9 @@ static int sc_conn_send(struct stconn *sc)
                return 1;
        }
 
-       if (channel_is_empty(oc))
-               sc_ep_report_send_activity(sc);
-       else {
+       if (!channel_is_empty(oc)) {
                /* We couldn't send all of our data, let the mux know we'd like to send more */
                conn->mux->subscribe(sc, SUB_RETRY_SEND, &sc->wait_event);
-               if (sc_state_in(sc->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO))
-                       sc_ep_report_blocked_send(sc);
        }
 
        return did_send;