]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-fcgi: Propagate flags to SE in fcgi_strm_wake_one_stream
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Feb 2025 14:06:45 +0000 (15:06 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Feb 2025 10:19:32 +0000 (11:19 +0100)
The commit is flagged as a bug because the same fix on the H2 multiplexer was
reported as a bug. But no issue was reported.

When a stream is explicitly woken up by the FCGI conneciton, if an error
condition is detected, the corresponding error flag is set on the SE. So
SE_FL_ERROR or SE_FL_ERR_PENDING, depending if the end of stream was
reported or not.

However, there is no attempt to propagate other termination flags. We must
be sure to properly set SE_FL_EOI and SE_FL_EOS when appropriate to be able
to switch a pending error to a fatal error.

Because of this bug, the SE could remain with a pending error and no end of
stream, preventing the applicative stream to trully abort it. It means on
some abort scenario, it seems to be possible to block a stream infinitely.

This patche depends on:

  * MEDIUM: mux-fcgi: Add a function to propagate termination flags from fstrm to SE
  * BUG/MEDIUM: mux-fcgi: Properly handle read0 on partial records

This patch could be backported at least as far as 2.8 after a period of
observation. However no bug was reportedn so there is no rush.

src/mux_fcgi.c

index bd6efc20e30844a859cadfbcdbb6a74ea1a83c04..7a8ceef5bc1875be2ac10bf14b42f10747a1227e 100644 (file)
@@ -1110,7 +1110,7 @@ static void fcgi_strm_wake_one_stream(struct fcgi_strm *fstrm)
 
        if (fconn->state == FCGI_CS_CLOSED || (fconn->flags & (FCGI_CF_ERR_PENDING|FCGI_CF_ERROR))) {
                se_fl_set_error(fstrm->sd);
-
+               fcgi_strm_propagate_term_flags(fconn, fstrm);
                if (fstrm->state < FCGI_SS_ERROR) {
                        fstrm->state = FCGI_SS_ERROR;
                        TRACE_STATE("switching to ERROR", FCGI_EV_STRM_WAKE|FCGI_EV_FSTRM_END, fconn->conn, fstrm);