Hi again In version 2.1.3: When config spoe engine proxys > 1, the function "srandom" will run more than one times, it will make some engine_id duplicated, and the SPOA is group SPOP connections by engine_id when option async is on, the ack will reply to the wrong SPOE.
This patch should backport to 2.0 and 1.9. My pleasure Kevin
From 512e4aca8e3ffd57fb3f12581ede6d8e8d624319 Mon Sep 17 00:00:00 2001 From: Kevin Zhu <ipand...@gmail.com> Date: Fri, 13 Mar 2020 14:40:46 +0800 Subject: [PATCH] BUG/MEDIUM: spoe: Use unique engine_id for all agents in all scopes When config spoe engine proxys > 1, the function "srandom" will run more than one times, it will make some engine_id duplicated, and the SPOA is group SPOP connections by engine_id when option async is on, the ack will reply to the wrong SPOE. --- src/flt_spoe.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 930ac8d..2181138 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -3118,14 +3118,17 @@ spoe_init_per_thread(struct proxy *p, struct flt_conf *fconf) { struct spoe_config *conf = fconf->conf; struct spoe_agent *agent = conf->agent; + static int init = 0; - /* Use a != seed per process */ - if (relative_pid > 1 && tid == 0) + if (HA_ATOMIC_LOAD(&init) == 0) { + HA_ATOMIC_STORE(&init, 1); srandom(now_ms * pid); + } agent->rt[tid].engine_id = generate_pseudo_uuid(); if (agent->rt[tid].engine_id == NULL) return -1; + return 0; } -- 2.7.4