1 From 7034083b5063d28276b986d645d18071aba5f4d5 Mon Sep 17 00:00:00 2001
2 From: Christopher Faulet <cfaulet@haproxy.com>
3 Date: Wed, 28 Feb 2018 13:33:26 +0100
4 Subject: [PATCH] BUG/MEDIUM: spoe: Remove idle applets from idle list when
7 In the SPOE applet's handler, when an applet is switched from the state IDLE to
8 PROCESSING, it is removed for the list of idle applets. But when HAProxy is
9 stopping, this applet can be switched to DISCONNECT. In this case, we also need
10 to remove it from the list of idle applets. Else the applet is removed but still
11 present in the list. It could lead to a segmentation fault or an infinite loop,
12 depending the code path.
14 (cherry picked from commit 7d9f1ba246055046eed547fa35aa546683021dce)
15 [wt: adapted context for 1.8]
16 Signed-off-by: Willy Tarreau <w@1wt.eu>
19 1 file changed, 1 insertion(+), 1 deletion(-)
21 diff --git a/src/flt_spoe.c b/src/flt_spoe.c
22 index 8fb6e0b..e76a352 100644
25 @@ -1866,6 +1866,7 @@ spoe_handle_appctx(struct appctx *appctx)
28 case SPOE_APPCTX_ST_IDLE:
29 + agent->rt[tid].applets_idle--;
31 LIST_ISEMPTY(&agent->rt[tid].sending_queue) &&
32 LIST_ISEMPTY(&SPOE_APPCTX(appctx)->waiting_queue)) {
33 @@ -1874,7 +1875,6 @@ spoe_handle_appctx(struct appctx *appctx)
34 appctx->st0 = SPOE_APPCTX_ST_DISCONNECT;
37 - agent->rt[tid].applets_idle--;
38 appctx->st0 = SPOE_APPCTX_ST_PROCESSING;