Le 05/07/2024 à 12:57, Maciej Zdeb a écrit :
Hi,
I'm using haproxy version 2.8.9 and noticed strange behavior of the SPOE engine.
I see many logs like below. From what I managed to investigate, the error with
value 2 is defined as SPOE_CTX_ERR_RES (an error was triggered during the
resources allocation) and this particular error is set only in
spoe_queue_context function.
So probably there is an issue with that logic of creating applets, but I'm
unable to understand what is wrong with it. I don't have any limits in spoe
configuration so it should not be the cause.
/* Check if we need to create a new SPOE applet or not. */
if (agent->rt[tid].processing < agent->rt[tid].idles ||
agent->rt[tid].processing <
read_freq_ctr(&agent->rt[tid].processing_per_sec))
goto end;
SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p"
" - try to create new SPOE appctx\n",
(int)date.tv_sec, (int)date.tv_usec, agent->id,
__FUNCTION__,
ctx->strm);
spoe_create_appctx(conf);
end:
/* The only reason to return an error is when there is no applet */
if (LIST_ISEMPTY(&agent->rt[tid].applets)) {
ctx->status_code = SPOE_CTX_ERR_RES;
return -1;
}
Hi Maciej,
Thanks for the report and sorry for the delay :/
I guess here the issue is that there are applets but not on the current thread.
The following patch should fix the issue. Could you confirm it really fixes your
issue ? it can safely be applied on the 2.8.9 or 2.8-HEAD.
FYI, I'm working on the SPOE refactoring. I hope the first version will be
available soon for testing.
--
Christopher Faulet
From 884bf036923119a762e26703c0b430f13aa58611 Mon Sep 17 00:00:00 2001
From: Christopher Faulet <cfau...@haproxy.com>
Date: Tue, 9 Jul 2024 08:24:05 +0200
Subject: [PATCH] BUG/MEDIUM: spoe: Be sure to create a SPOE applet if none on
the current thread
When a message is queued, waiting to be processed by a SPOE applet, there
are some heuristic to know if a new applet must be created or not. There are
2 conditions to skip the applet creation:
1 - if there are enough idle applets on the current thread, or,
2 - if the processing rate on the current thread is high enough to handle
this new message
In the 2nd case, there is a flaw when the number of processed messages falls
to zero while the processing rate is still greater than zero. In that case,
we will skip the SPOE applet creation without taking care to check there is
at least one applet on the current thread.
So now, the conditions above to skip the SPOE applet creation are only
evaluated if there is at least one applet on the current thread.
This patch must be backported to every stable versions.
---
src/flt_spoe.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index f565e962d..0b35b7eed 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -2090,8 +2090,9 @@ spoe_queue_context(struct spoe_context *ctx)
struct spoe_appctx *spoe_appctx;
/* Check if we need to create a new SPOE applet or not. */
- if (agent->rt[tid].processing < agent->rt[tid].idles ||
- agent->rt[tid].processing < read_freq_ctr(&agent->rt[tid].processing_per_sec))
+ if (!LIST_ISEMPTY(&agent->rt[tid].applets) &&
+ (agent->rt[tid].processing < agent->rt[tid].idles ||
+ agent->rt[tid].processing < read_freq_ctr(&agent->rt[tid].processing_per_sec)))
goto end;
SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p"
--
2.45.1