On Mon, Nov 20, 2017 at 10:02:57PM +0100, PiBa-NL wrote:
> Hi Willy,
> Op 20-11-2017 om 21:46 schreef Willy Tarreau:
> > Hi Pieter,
> > 
> > On Mon, Nov 20, 2017 at 01:47:48AM +0100, PiBa-NL wrote:
> > > Hmmm thinking about it there might be something. Could you start with
> > > "-dk" to disable kqueue and fall back to poll ? kqueue registers a post-
> > > fork function to close and reopen the kqueue fd. I wouldn't be surprized
> > > if we're having a problem with it not being placed exactly where needed
> > > when running in master-worker mode. Or maybe we need to call it twice
> > > when forking into background and one call is missing somewhere.
> > > 
> > > Thanks!
> > > Willy
> 
> With -dk it starts in background and serves the stats page as expected.
> 
> So seems indeed related to the poller used in combination with
> master-worker.

OK thank you. I suspect something wrong happens, such as the master
killing the same kevent_fd as the other ones are using or something
like this.

Could you please try the attached patch just in case it fixes anything ?
I have not testedit and it may even break epoll, but one thing at a
time :-)

Thanks,
Willy
diff --git a/src/haproxy.c b/src/haproxy.c
index b39a95f..a321158 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2671,6 +2671,7 @@ int main(int argc, char **argv)
                        /* parent leave to daemonize */
                        if (ret > 0)
                                exit(0);
+                       fork_poller();
                }
 
                if (global.mode & MODE_MWORKER) {
@@ -2711,8 +2712,10 @@ int main(int argc, char **argv)
                                protocol_unbind_all();
                                exit(1); /* there has been an error */
                        }
-                       else if (ret == 0) /* child breaks here */
+                       else if (ret == 0) { /* child breaks here */
+                               fork_poller();
                                break;
+                       }
                        children[proc] = ret;
                        if (pidfd >= 0 && !(global.mode & MODE_MWORKER)) {
                                char pidstr[100];

Reply via email to