BUG/MEDIUM: mux-h2: Propagate termination flags when frontend SC is created

We must evaluate if EOS/EOI/ERR_PENDING/ERROR flags must be set on the SE
when the frontend SC is created because the rxbuf is transferred to the
steeam at this stage. It means the call to h2_rcv_buf() may be skipped on
some circumstances.

And indeed, it happens when HAproxy quickly replies, for instance because of
a deny rule. In this case, depending on the scheduling, the abort may block
the receive attempt from the SC. In this case if SE flags were not properly
set earlier, there is no way to terminate the request and the session may be
freezed.

For now, I can't explain why there is no timeout when this happens but it
remains an issue because here we should not rely on timeouts to close the
stream.

This patch relies on following commits:

    * MINOR: mux-h2: Add a function to propagate termination flags from h2s to SE
    * MINOR: mux-h2: Set H2_SF_ES_RCVD flag when decoding the HEADERS frame

The issue was encountered on the 2.8 but it seems the bug exists since the
2.4. But it is probably a good idea to only backport the series to 2.7 only
and wait for a bug report on earlier versions.

This patch should solve the issue #2147.
This commit is contained in:
Christopher Faulet 2023-05-24 11:34:45 +02:00
parent 531dd050ff
commit c2f1d0ee5e
1 changed files with 1 additions and 0 deletions

View File

@ -2819,6 +2819,7 @@ static struct h2s *h2c_frt_handle_headers(struct h2c *h2c, struct h2s *h2s)
h2s->st = H2_SS_OPEN; h2s->st = H2_SS_OPEN;
h2s->flags |= flags; h2s->flags |= flags;
h2s->body_len = body_len; h2s->body_len = body_len;
h2s_propagate_term_flags(h2c, h2s);
done: done:
if (h2s->flags & H2_SF_ES_RCVD) { if (h2s->flags & H2_SF_ES_RCVD) {