Le 18/05/2018 à 14:53, Christopher Faulet a écrit :
Le 18/05/2018 à 12:38, Thierry FOURNIER a écrit :
Hi,
In attachment two patches for SPOE.
The first fix an error message, and the second fix a mistake in the protocol.
Thanks Thierry for these patches. Here are fixes for the SPOAs
modsecurity and mod_defender.
And because this is Friday and the sun shines, 2 more patches to do some
cleanup in the SPOE.
Thanks
--
Christopher Faulet
>From 78bb0889c45e5ffecfd693787823f32b9a5e90cf Mon Sep 17 00:00:00 2001
From: Christopher Faulet <[email protected]>
Date: Fri, 6 Apr 2018 11:34:12 +0200
Subject: [PATCH 1/2] CLEANUP: spoe: Remove unused variables the agent
structure
applets_act and applets_idle were used for debugging purpose. Now, these values
are part of the agent's counters.
---
include/types/spoe.h | 4 ----
src/flt_spoe.c | 12 ++----------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/include/types/spoe.h b/include/types/spoe.h
index c01a03ef..2f13d375 100644
--- a/include/types/spoe.h
+++ b/include/types/spoe.h
@@ -265,10 +265,6 @@ struct spoe_agent {
/* running info */
struct {
unsigned int frame_size; /* current maximum frame size, only used to encode messages */
-#if defined(DEBUG_SPOE) || defined(DEBUG_FULL)
- unsigned int applets_act; /* # of applets alive at a time */
- unsigned int applets_idle; /* # of applets in the state SPOE_APPCTX_ST_IDLE */
-#endif
unsigned int processing;
struct freq_ctr processing_per_sec;
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 4e27c63b..f96a94f3 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1239,7 +1239,6 @@ spoe_release_appctx(struct appctx *appctx)
__FUNCTION__, appctx);
/* Remove applet from the list of running applets */
- SPOE_DEBUG_STMT(agent->rt[tid].applets_act--);
HA_ATOMIC_SUB(&agent->counters.applets, 1);
HA_SPIN_LOCK(SPOE_APPLET_LOCK, &agent->rt[tid].lock);
if (!LIST_ISEMPTY(&spoe_appctx->list)) {
@@ -1252,7 +1251,6 @@ spoe_release_appctx(struct appctx *appctx)
if (appctx->st0 != SPOE_APPCTX_ST_END) {
if (appctx->st0 == SPOE_APPCTX_ST_IDLE) {
eb32_delete(&spoe_appctx->node);
- SPOE_DEBUG_STMT(agent->rt[tid].applets_idle--);
HA_ATOMIC_SUB(&agent->counters.idles, 1);
}
@@ -1437,7 +1435,6 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
default:
/* HELLO handshake is finished, set the idle timeout and
* add the applet in the list of running applets. */
- SPOE_DEBUG_STMT(agent->rt[tid].applets_idle++);
HA_ATOMIC_ADD(&agent->counters.idles, 1);
appctx->st0 = SPOE_APPCTX_ST_IDLE;
SPOE_APPCTX(appctx)->node.key = 0;
@@ -1725,7 +1722,6 @@ spoe_handle_processing_appctx(struct appctx *appctx)
}
if (appctx->st0 == SPOE_APPCTX_ST_PROCESSING && SPOE_APPCTX(appctx)->cur_fpa < agent->max_fpa) {
- SPOE_DEBUG_STMT(agent->rt[tid].applets_idle++);
HA_ATOMIC_ADD(&agent->counters.idles, 1);
appctx->st0 = SPOE_APPCTX_ST_IDLE;
eb32_insert(&agent->rt[tid].idle_applets, &SPOE_APPCTX(appctx)->node);
@@ -1889,7 +1885,6 @@ spoe_handle_appctx(struct appctx *appctx)
goto switchstate;
case SPOE_APPCTX_ST_IDLE:
- SPOE_DEBUG_STMT(agent->rt[tid].applets_idle--);
HA_ATOMIC_SUB(&agent->counters.idles, 1);
eb32_delete(&SPOE_APPCTX(appctx)->node);
if (stopping &&
@@ -2007,7 +2002,6 @@ spoe_create_appctx(struct spoe_config *conf)
HA_SPIN_LOCK(SPOE_APPLET_LOCK, &conf->agent->rt[tid].lock);
LIST_ADDQ(&conf->agent->rt[tid].applets, &SPOE_APPCTX(appctx)->list);
HA_SPIN_UNLOCK(SPOE_APPLET_LOCK, &conf->agent->rt[tid].lock);
- SPOE_DEBUG_STMT(conf->agent->rt[tid].applets_act++);
HA_ATOMIC_ADD(&conf->agent->counters.applets, 1);
task_wakeup(SPOE_APPCTX(appctx)->task, TASK_WOKEN_INIT);
@@ -2099,9 +2093,9 @@ spoe_queue_context(struct spoe_context *ctx)
SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p"
" - Add stream in sending queue"
- " - applets_act=%u - applets_idle=%u - processing=%u\n",
+ " - applets=%u - idles=%u - processing=%u\n",
(int)now.tv_sec, (int)now.tv_usec, agent->id, __FUNCTION__,
- ctx->strm, agent->rt[tid].applets_act, agent->rt[tid].applets_idle,
+ ctx->strm, agent->counters.applets, agent->counters.idles,
agent->rt[tid].processing);
/* Finally try to wakeup an IDLE applet. */
@@ -3358,8 +3352,6 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
}
for (i = 0; i < global.nbthread; ++i) {
curagent->rt[i].frame_size = curagent->max_frame_size;
- SPOE_DEBUG_STMT(curagent->rt[i].applets_act = 0);
- SPOE_DEBUG_STMT(curagent->rt[i].applets_idle = 0);
curagent->rt[i].processing = 0;
LIST_INIT(&curagent->rt[i].applets);
LIST_INIT(&curagent->rt[i].sending_queue);
--
2.14.3
>From 89b43747600962ed2225b3ba69549fa4156ccfcd Mon Sep 17 00:00:00 2001
From: Christopher Faulet <[email protected]>
Date: Thu, 26 Apr 2018 14:25:43 +0200
Subject: [PATCH 2/2] DOC: spoe: fix a typo
---
doc/SPOE.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/SPOE.txt b/doc/SPOE.txt
index c34102a6..9556bc90 100644
--- a/doc/SPOE.txt
+++ b/doc/SPOE.txt
@@ -1205,7 +1205,7 @@ LOG_NOTICE. Otherwise, the message is logged with the level LOG_WARNING.
The messages are logged using the agent's logger, if defined, and use the
following format:
- SPOE: [AGENT] <TYPE:NAME> sid=STREAM-ID st=STATUC-CODE reqT/qT/wT/resT/pT \
+ SPOE: [AGENT] <TYPE:NAME> sid=STREAM-ID st=STATUS-CODE reqT/qT/wT/resT/pT \
<idles>/<applets> <nb_sending>/<nb_waiting> <nb_error>/<nb_processed>
AGENT is the agent name
--
2.14.3