[Patch] potential 100% cpu loop arround reinit_after_fork_pipe_handler()

Stefan Metzmacher metze at samba.org
Tue Apr 24 09:28:05 UTC 2018


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:-)

-------------- next part --------------
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);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180424/acd6d7df/signature.sig>

More information about the samba-technical mailing list