]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Wake applets on sending path if there is a pending shutdown
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 1 Sep 2023 11:55:42 +0000 (13:55 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 1 Sep 2023 12:18:26 +0000 (14:18 +0200)
An applet is not woken up on sending path if it is not waiting for data or
if it states it will not consume data. However, it is important to still
wake it up if there is a pending shutdown. Otherwise, the event may be
missed and some data may remain blocked in the channel's buffer.

Because of this bug, it is possible to have a stream stuck if data are also
blocked on the opposite channel. It is for instance possible to hit the buf
with the stats applet and a client not consuming data.

This patch must slowly be backported as far as 2.2. It should partially fix
issue #2249.

src/stconn.c

index c30a8dddd569733701611f003e0645f778d4bafb..643d78e376219111b73d1b03f72b37eeb07a0a99 100644 (file)
@@ -958,8 +958,10 @@ static void sc_app_chk_snd_applet(struct stconn *sc)
        if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUT_DONE)))
                return;
 
-       /* we only wake the applet up if it was waiting for some data  and is ready to consume it */
-       if (!sc_ep_test(sc, SE_FL_WAIT_DATA) || sc_ep_test(sc, SE_FL_WONT_CONSUME))
+       /* we only wake the applet up if it was waiting for some data  and is ready to consume it
+        * or if there is a pending shutdown
+        */
+       if (!sc_ep_test(sc, SE_FL_WAIT_DATA|SE_FL_WONT_CONSUME) && !(sc->flags & SC_FL_SHUT_WANTED))
                return;
 
        if (!channel_is_empty(oc)) {