BUG/MEDIUM: filters: Fix a typo when a filter is attached blocking the release

When a filter is attached to a stream, the wrong FLT_END analyzer is added
on the request channel. AN_REQ_FLT_END must be added instead of
AN_RES_FLT_END. Because of this bug, the stream may hang on the filter
release stage.

It seems to be ok for HTTP filters (cache & compression) in HTTP mode. But
when enabled on a TCP proxy, the stream is blocked until the client or the
server timeout expire because data forwarding is blocked. The stream is then
prematurely aborted.

This bug was introduced by commit 26eb5ea35 ("BUG/MINOR: filters: Always set
FLT_END analyser when CF_FLT_ANALYZE flag is set"). The patch must be
backported in all stable versions.
This commit is contained in:
Christopher Faulet 2021-10-04 07:50:13 +02:00
parent 1cdb531ec8
commit d28b2b2352
2 changed files with 33 additions and 1 deletions

View File

@ -37,6 +37,16 @@ server s1 {
rxreq
expect req.url == "/"
txresp -nolen
close
accept
rxreq
expect req.url == "/"
expect req.bodylen == 20480
txresp -nolen \
-hdr "Content-Type: text/plain" \
-bodylen 20480
} -start
haproxy h1 -conf {
@ -60,6 +70,14 @@ haproxy h1 -conf {
backend be1
server www ${s1_addr}:${s1_port}
listen li1
mode tcp
bind "fd@${li1}"
# Validate nothing is blocked in TCP mode
filter compression
server www ${s1_addr}:${s1_port}
} -start
client c1 -connect ${h1_fe1_sock} {
@ -105,3 +123,17 @@ client c3 -connect ${h1_fe1_sock} {
expect resp.http.content-length == "<undef>"
expect resp.bodylen == 0
} -run
client c4 -connect ${h1_li1_sock} {
txreq -url "/" \
-hdr "Accept-Encoding: gzip" \
-hdr "Content-Type: text/plain" \
-bodylen 20480
rxresp
expect resp.status == 200
expect resp.http.content-encoding == "<undef>"
expect resp.http.transfer-encoding == "<undef>"
expect resp.http.content-length == "<undef>"
expect resp.bodylen == 20480
expect_close
} -run

View File

@ -475,7 +475,7 @@ flt_stream_start(struct stream *s)
}
if (strm_li(s) && (strm_li(s)->analysers & AN_REQ_FLT_START_FE)) {
s->req.flags |= CF_FLT_ANALYZE;
s->req.analysers |= AN_RES_FLT_END;
s->req.analysers |= AN_REQ_FLT_END;
}
return 0;
}