]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: applet: Report an error if applet request more room on aborted SC
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Sep 2023 06:52:39 +0000 (08:52 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Sep 2023 07:29:27 +0000 (09:29 +0200)
If an abort was performed and the applet still request more room, it means
the applet has not properly handle the error on its own. At least the CLI
applet is concerned. Instead of reviewing all applets, the error is now
handled in task_run_applet() function.

Because of this bug, a session may be blocked infinitly and may also lead to
a wakup loop.

This patch must only be backported to 2.8 for now. And only to lower
versions if a bug is reported because it is a bit sensitive and the code
older versions are very different.

src/applet.c

index f4c5c862ed3c2c5ce1e1e50621600e51868dd483..0264d06b14349d120205bb7e5026b409aa8a354a 100644 (file)
@@ -465,7 +465,10 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
        if (sc_ic(sc)->flags & CF_READ_EVENT)
                sc_ep_report_read_activity(sc);
 
-       if (channel_is_empty(sc_oc(sc)))
+       if (sc_waiting_room(sc) && (sc->flags & SC_FL_ABRT_DONE)) {
+               sc_ep_set(sc, SE_FL_EOS|SE_FL_ERROR);
+       }
+       else if (channel_is_empty(sc_oc(sc)))
                sc_ep_report_send_activity(sc);
        else {
                sc_ep_report_blocked_send(sc);