From 3c066b1e341ce2093197d565f2711e6174c39d5b Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 14 Mar 2024 10:21:56 +0100 Subject: [PATCH] BUG/MEDIUM: spoe: Don't rely on stream's expiration to detect processing timeout On stream side, the SPOE filter relied on the stream's expiration date to be woken up and be able to detect processing timeout. However, the stream expiration date must not be updated this way. Mainly because it may be overwritten at the end of process_stream(). In the worst case, it is set to TICK_ETERNITY for any reason. In this case, it is impossible to detect the SPOE filter must time out and abort the processing. The right way to do is to set an analysis expiration date on the corresponding channel, depending on the direction. This expiration date will be used to compute the stream's expiration date at the end of process_stream(). This patch may be related to issue #2478. It must be backported to all stable versions. --- src/flt_spoe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/flt_spoe.c b/src/flt_spoe.c index d83eff9bf..cd65c0e49 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -2625,6 +2625,8 @@ spoe_stop_processing(struct spoe_agent *agent, struct spoe_context *ctx) /* Reset processing timer */ ctx->process_exp = TICK_ETERNITY; + ctx->strm->req.analyse_exp = TICK_ETERNITY; + ctx->strm->res.analyse_exp = TICK_ETERNITY; spoe_release_buffer(&ctx->buffer, &ctx->buffer_wait); @@ -2683,8 +2685,10 @@ spoe_process_messages(struct stream *s, struct spoe_context *ctx, if (!tick_isset(ctx->process_exp)) { ctx->process_exp = tick_add_ifset(now_ms, agent->timeout.processing); - s->task->expire = tick_first((tick_is_expired(s->task->expire, now_ms) ? 0 : s->task->expire), - ctx->process_exp); + if (dir == SMP_OPT_DIR_REQ) + s->req.analyse_exp = ctx->process_exp; + else + s->res.analyse_exp = ctx->process_exp; } ret = spoe_start_processing(agent, ctx, dir); if (!ret)