BUG/MEDIUM: spoe: Never create new spoe applet if there is no server up

This test was already performed when a new message is queued into the
sending queue. However not when the last applet is released, in
spoe_release_appctx(). It is a quite old bug. It was introduced by commit
6f1296b5c7 ("BUG/MEDIUM: spoe: Create a SPOE applet if necessary when the
last one is released").

Because of this bug, new SPOE applets may be created and quickly released
because there is no server up, in loop and while there is at least one
message in the sending queue, consuming all the CPU. It is pretty visible if
the processing timeout is high.

To fix the bug, conditions to create or not a SPOE applet are now
centralized in spoe_create_appctx(). The test about the max connections per
second and about number of active servers are moved in this function.

This patch must be backported to all stable versions.

(cherry picked from commit 72c23bd4cd3ee3a79955fbdd601206a9fa7d19eb)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 4b844d71491a9aae308f67d1f44e9fe39188b870)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 60ce468225b9a4e4fcbb74263e77ed69b17e8ff7)
[cf: now is used instead of date in log messages]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 887376a919dce2be39731d4df7db3f1d4dec7440)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit b8d61c2ea46ae68c6f50aef0451fd8a11968ff15)
[cf: ctx adjt. Applet creation differs]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed