Hi Lukas,

On Tue, Jul 09, 2019 at 03:59:04PM +0200, Lukas Tribus wrote:
> Hello Veiko,
> 
> 
> On Tue, 9 Jul 2019 at 15:40, Veiko Kukk <vk...@xvidservices.com> wrote:
> >
> > On 2019-07-08 16:06, Lukas Tribus wrote:
> > > The bug you may be affected by is:
> > > https://github.com/haproxy/haproxy/issues/141
> > >
> > > Can you check what happens with:
> > > nbthread 1
> >
> > I'm afraid I can't because those are production systems that won't be
> > able to service with single thread, they have relatively high ssl
> > termination load.
> 
> You could probably raise nbproc at that point, if you can get away
> with some stats issues ...
> 
> How are you currently working around this issue? Did you disable
> external checks? I'd assume failing checks have negative impact on
> production systems also.
> 
> 
> Willy, in issue #141 in sounds like you already have an idea how this
> could be fixed, is there a patch that we can ask Veiko to try for
> this?

I didn't have a patch but just did it. It was only compile-tested,
please verify that it works as expected on a non-sensitive machine
first!

Cheers,
Willy
>From 32205189f881b98cb0bbe6ed32178f2929e9a627 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Tue, 9 Jul 2019 16:27:39 +0200
Subject: WIP/BUG: checks: make sure we isolate the thread doing the fork

---
 src/checks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/checks.c b/src/checks.c
index d3920ce8d..46f93e58f 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1977,8 +1977,10 @@ static int connect_proc_chk(struct task *t)
 
        block_sigchld();
 
+       thread_isolate();
        pid = fork();
        if (pid < 0) {
+               thread_release();
                ha_alert("Failed to fork process for external health check: %s. 
Aborting.\n",
                         strerror(errno));
                set_server_check_status(check, HCHK_STATUS_SOCKERR, 
strerror(errno));
@@ -2015,6 +2017,7 @@ static int connect_proc_chk(struct task *t)
        }
 
        /* Parent */
+       thread_release();
        if (check->result == CHK_RES_UNKNOWN) {
                if (pid_list_add(pid, t) != NULL) {
                        t->expire = tick_add(now_ms, MS_TO_TICKS(check->inter));
-- 
2.20.1

Reply via email to