[Patch] potential 100% cpu loop arround reinit_after_fork_pipe_handler()
jra at samba.org
Tue Apr 24 17:06:09 UTC 2018
On Tue, Apr 24, 2018 at 11:28:05AM +0200, Stefan Metzmacher via samba-technical wrote:
> here's a small optimization to reinit_after_fork_pipe_handler().
> Once the pipe is disconnected we should unregister the fd event handler
> in order to avoid a 100% cpu loop.
> In practice this doesn't happen as the SIGTERM event handler will be
> called first, but due to a work in progress bug I was able to
> trigger that loop during private autobuilds...
> Please review and push:-)
> From 4696d2109bb7ab88a47871f8ff4b8e6689c3aab4 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 22 Mar 2018 12:32:15 +0100
> Subject: [PATCH] s3:util: remove reinit_after_fork_pipe_handler before sending
> We should not keep the tevent_fd active when we sending us a SIGTERM,
> this is not a real problem, but due to a different bug I triggered
> a 100% cpu loop. I think it's safer to idle in that case instead
> of waisting a lot of energy.
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> source3/lib/util.c | 1 +
> 1 file changed, 1 insertion(+)
> diff --git a/source3/lib/util.c b/source3/lib/util.c
> index 5f786f9..394fa5f 100644
> --- a/source3/lib/util.c
> +++ b/source3/lib/util.c
> @@ -438,6 +438,7 @@ static void reinit_after_fork_pipe_handler(struct tevent_context *ev,
> * we have reached EOF on stdin, which means the
> * parent has exited. Shutdown the server
> + TALLOC_FREE(fde);
> (void)kill(getpid(), SIGTERM);
More information about the samba-technical