Discussion:
[Patch] potential 100% cpu loop arround reinit_after_fork_pipe_handler()
Stefan Metzmacher via samba-technical
2018-04-24 09:28:05 UTC
Permalink
Hi,

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

Thanks!
metze
Jeremy Allison via samba-technical
2018-04-24 17:06:09 UTC
Permalink
Post by Stefan Metzmacher via samba-technical
Hi,
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:-)
LGTM. RB+
Post by Stefan Metzmacher via samba-technical
From 4696d2109bb7ab88a47871f8ff4b8e6689c3aab4 Mon Sep 17 00:00:00 2001
Date: Thu, 22 Mar 2018 12:32:15 +0100
Subject: [PATCH] s3:util: remove reinit_after_fork_pipe_handler before sending
SIGTERM
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.
---
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);
}
}
--
1.9.1
Loading...