BUG/MEDIUM: stconn: Do nothing in sc_conn_recv() when the SC needs more room
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 12 Apr 2023 16:35:18 +0000 (18:35 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Apr 2023 10:13:09 +0000 (12:13 +0200)
We erroneously though that an attempt to receive data was not possible if the SC
was waiting for more room in the channel buffer. A BUG_ON() was added to detect
bugs. And in fact, it is possible.

The regression was added in commit 341a5783b ("BUG/MEDIUM: stconn: stop to
enable/disable reads from streams via si_update_rx").

This patch should fix the issue #2115. It must be backported if the commit
above is backported.

src/stconn.c

index b1d02d9..95fe9c5 100644 (file)
@@ -1194,7 +1194,7 @@ static int sc_conn_recv(struct stconn *sc)
        /* If another call to sc_conn_recv() failed, and we subscribed to
         * recv events already, give up now.
         */
-       if (sc->wait_event.events & SUB_RETRY_RECV)
+       if ((sc->wait_event.events & SUB_RETRY_RECV) || sc_waiting_room(sc))
                return 0;
 
        /* maybe we were called immediately after an asynchronous shutr */
@@ -1220,7 +1220,6 @@ static int sc_conn_recv(struct stconn *sc)
 
        /* prepare to detect if the mux needs more room */
        sc_ep_clr(sc, SE_FL_WANT_ROOM);
-       BUG_ON(sc_waiting_room(sc));
 
        if ((ic->flags & (CF_STREAMER | CF_STREAMER_FAST)) && !co_data(ic) &&
            global.tune.idle_timer &&