From 183780a60e3f3197260d3c9143ffaa09b1df2c39 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 18 Oct 2021 15:06:20 +0200 Subject: [PATCH] BUG/MEDIUM: stream: Keep FLT_END analyzers if a stream detects a channel error If a channel error (READ_ERRO|READ_TIMEOUT|WRITE_ERROR|WRITE_TIMEOUT) is detected by the stream, in process_stream(), FLT_END analyers must be preserved. It is important to be sure to ends filter analysis and be able to release the stream. First, filters may release some ressources when FLT_END analyzers are called. Then, the CF_FL_ANALYZE flag is used to sync end of analysis for the request and the response. If FLT_END analyzer is ignored on a channel, this may block the other side and freeze the stream. This patch must be backported to all stable versions (cherry picked from commit 813f913444726eafbc06050ce1d1623f5d84bc38) Signed-off-by: Christopher Faulet (cherry picked from commit c94f727ea1a38656d93097bee551ab1375c8fe6d) Signed-off-by: Christopher Faulet --- src/stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stream.c b/src/stream.c index 27e5dcd..de2760e 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1899,7 +1899,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state) if (unlikely(!(s->flags & SF_ERR_MASK))) { if (req->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) { /* Report it if the client got an error or a read timeout expired */ - req->analysers = 0; + req->analysers &= AN_REQ_FLT_END; if (req->flags & CF_READ_ERROR) { _HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1); _HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1); @@ -1953,7 +1953,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state) } else if (res->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) { /* Report it if the server got an error or a read timeout expired */ - res->analysers = 0; + res->analysers &= AN_RES_FLT_END; if (res->flags & CF_READ_ERROR) { _HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1); _HA_ATOMIC_ADD(&sess->fe->fe_counters.srv_aborts, 1); -- 1.7.10.4