BUG/MEDIUM: Remove sync sends from streams to applets
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Jul 2025 13:15:34 +0000 (15:15 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Oct 2025 14:48:33 +0000 (16:48 +0200)
When the applet API was reviewed to use dedicated buffers, the support for
sends from the streams to applets was added. Unfortunately, it was not a
good idea because this way it is possible to deliver data to an applet and
release it just after, truncated data. Indeed, the release stage for applets
is related to the stream release itself. However, unlike the multiplexers,
the applets cannot survive to a stream for now.

So, for now, the sync sends from the streams is removed for applets, waiting
for a better way to handle the applets release stage.

Note that this only concerns applets using their own buffers. And of now,
the bug is harmless because all refactored applets are on server side and
consume data first. But this will be an issue with the HTTP client.

This patch should be backported as far as 3.0 after a period of observation.

(cherry picked from commit d9855102cf303948ffc842e8c0f7939e67a29bd9)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit 72ca5e5e8f3fcbc2f2ef6ed312e424a22235730d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 99039c8e6ece475b5e19b1df4d0c7a9702bd6dc2)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

include/haproxy/sc_strm.h

index f5bb9c2..996b7ea 100644 (file)
@@ -348,15 +348,6 @@ static inline void sc_sync_send(struct stconn *sc)
 {
        if (sc_ep_test(sc, SE_FL_T_MUX))
                sc_conn_sync_send(sc);
-       else if (sc_ep_test(sc, SE_FL_T_APPLET)) {
-               sc_applet_sync_send(sc);
-               if (sc_oc(sc)->flags & CF_WRITE_EVENT) {
-                       /* Data was send, wake the applet up. It is safe to do so becasuse sc_applet_sync_send()
-                        * removes CF_WRITE_EVENT flag from the channel before trying to send data to the applet.
-                        */
-                       task_wakeup(__sc_appctx(sc)->t, TASK_WOKEN_OTHER);
-               }
-       }
 }
 
 /* Combines both sc_update_rx() and sc_update_tx() at once */