From: Christopher Faulet Date: Wed, 10 May 2023 14:40:27 +0000 (+0200) Subject: MEDIUM: stream: Resync analyzers at the end of process_stream() on change X-Git-Tag: v2.8-dev11~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd90a165643d1178b45ea167423d6c51346f867b;p=thirdparty%2Fhaproxy.git MEDIUM: stream: Resync analyzers at the end of process_stream() on change At the end of process_stream(), if there was any change on request/response analyzers, we now trigger a resync. It is performed if any analyzer is added but also removed. It should help to catch internal changes on a stream and eventually avoid it to be frozen. There is no reason to backport this patch. But it may be good to keep an eye on it, just in case. --- diff --git a/src/stream.c b/src/stream.c index 8505aefd52..4bcc545a15 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1719,7 +1719,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) unsigned int rqf_last, rpf_last; unsigned int rq_prod_last, rq_cons_last; unsigned int rp_cons_last, rp_prod_last; - unsigned int req_ana_back; + unsigned int req_ana_back, res_ana_back; struct channel *req, *res; struct stconn *scf, *scb; unsigned int rate; @@ -2121,6 +2121,11 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) goto resync_response; } + /* we'll monitor the response analysers because some response analysers + * may be enabled/disabled later + */ + res_ana_back = res->analysers; + /* maybe someone has added some request analysers, so we must check and loop */ if (req->analysers & ~req_ana_back) goto resync_request; @@ -2521,10 +2526,12 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) goto resync_request; if (((scb->flags ^ scb_flags) & (SC_FL_EOS|SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) || - ((scf->flags ^ scf_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) + ((scf->flags ^ scf_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) || + (res->analysers ^ res_ana_back)) goto resync_response; - if (((req->flags ^ rqf_last) | (res->flags ^ rpf_last)) & CF_MASK_ANALYSER) + if ((((req->flags ^ rqf_last) | (res->flags ^ rpf_last)) & CF_MASK_ANALYSER) || + (req->analysers ^ req_ana_back)) goto resync_request; /* we're interested in getting wakeups again */