Le 23/12/2018 à 21:17, PiBa-NL a écrit :
Hi List,

Attached a new test to verify that the 'mailers' section is working
properly.
Currently with 1.9 the mailers sends thousands of mails for my setup...

As the test is rather slow i have marked it with a starting letter 's'.

Note that the test also fails on 1.6/1.7/1.8 but can be 'fixed' there by
adding a 'timeout mail 200ms'.. (except on 1.6 which doesn't have that
setting.)

I don't think that should be needed though if everything was working
properly?

If the test could be committed, and related issues exposed fixed that
would be neat ;)

Thanks in advance,

PiBa-NL (Pieter)


Hi Pieter,

About the timing issue, could you try the following patch please ? With it, I can run the regtest about email alerts without any error.

Thanks,
--
Christopher Faulet
>From 8b7822ad2c7d9e4f9fe6b19f57d1d1ff01336a70 Mon Sep 17 00:00:00 2001
From: Christopher Faulet <cfau...@haproxy.com>
Date: Mon, 21 Jan 2019 14:15:50 +0100
Subject: [PATCH] BUG/MINOR: check: Wake the check task if the check is
 finished in wake_srv_chk()

With tcp-check, the result of the check is set by the function tcpcheck_main()
from the I/O layer. So it is important to wake up the check task to handle the
result and finish the check. Otherwise, we will wait the task timeout to handle
the result of a tcp-check, delaying the next check by as much.

This patch also fixes a problem about email alerts reported by PiBa-NL (Pieter)
on the ML [1] on all versions since the 1.6. So this patch must be backported
from 1.9 to 1.6.

[1] https://www.mail-archive.com/haproxy@formilux.org/msg32190.html
---
 src/checks.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/checks.c b/src/checks.c
index 1a81ccdb3..b0de77088 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1442,12 +1442,13 @@ static int wake_srv_chk(struct conn_stream *cs)
 	}
 
 	if (check->result != CHK_RES_UNKNOWN) {
-		/* We're here because nobody wants to handle the error, so we
-		 * sure want to abort the hard way.
-		 */
+		/* Check complete or aborted. If connection not yet closed do it
+		 * now and wake the check task up to be sure the result is
+		 * handled ASAP. */
 		conn_sock_drain(conn);
 		cs_close(cs);
 		ret = -1;
+		task_wakeup(check->task, TASK_WOKEN_IO);
 	}
 
 	if (check->server)
-- 
2.20.1

Reply via email to