From: Christopher Faulet Date: Thu, 18 Apr 2024 07:05:11 +0000 (+0200) Subject: BUG/MEDIUM: peers: Fix exit condition when max-updates-at-once is reached X-Git-Tag: v3.0-dev8~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=494bc03ff73ba82d5ec7a9f9cc8c3d3d72586286;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: peers: Fix exit condition when max-updates-at-once is reached When a peer applet is pushing updates, we limit the number of update sent at once via a global parameter to not spend too much time in the applet. On interrupt, we claimed for more room to be woken up quickly. However, this statement is only true if something was pushed in the buffer. Otherwise, with an empty buffer, if the stream itself is not woken up, the applet remains also blocked because there is no send activity on the other side to unblock it. In this case, instead of requesting more room, it is sufficient to state the applet have more data to send. This patch must be backported as far as 2.6. --- diff --git a/src/peers.c b/src/peers.c index d6b4012b6d..904eb446a9 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1637,10 +1637,7 @@ static inline int peer_send_teachmsgs(struct appctx *appctx, struct peer *p, updates_sent++; if (updates_sent >= peers_max_updates_at_once) { - /* pretend we're full so that we get back ASAP */ - struct stconn *sc = appctx_sc(appctx); - - sc_need_room(sc, 0); + applet_have_more_data(appctx); ret = -1; break; } @@ -2695,10 +2692,7 @@ static inline int peer_send_msgs(struct appctx *appctx, updates++; if (updates >= peers_max_updates_at_once) { - /* pretend we're full so that we get back ASAP */ - struct stconn *sc = appctx_sc(appctx); - - sc_need_room(sc, 0); + applet_have_more_data(appctx); return -1; }