Commit b5d9864f authored by Shane Kerr's avatar Shane Kerr
Browse files

Moved child process cleanup out of signal handler.

Fix for broken msgq startup.
Update TODO.



git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@438 e5f2f494-b856-4b98-b285-d166d9295462
parent 8b3bc064
- Move child cleanup & restart out of signal handler
- Read msgq configuration from configuration manager
- Provide more administrator options:
- Get process list
......@@ -12,3 +11,4 @@
- Back-off mechanism for restarting failed processes
- Start statistics daemon
- Statistics interaction (?)
- Stop using poll(), as primitive operating systems (OS X) don't support it
......@@ -112,7 +112,7 @@ class BoB:
while self.cc_session is None:
# if we have been trying for "a while" give up
if (time.time() - cc_connect_start) > 5:
c_channel.kill()
c_channel.process.kill()
return "Unable to connect to c-channel after 5 seconds"
# try to connect, and if we can't wait a short while
try:
......@@ -279,16 +279,10 @@ class BoB:
if __name__ == "__main__":
def reaper(signal_number, stack_frame):
"""A child process has died (SIGCHLD received)."""
global boss_of_bind
while True:
try:
(pid, exit_status) = os.waitpid(-1, os.WNOHANG)
except OSError as o:
if o.errno == errno.ECHILD: break
raise
if pid == 0: break
if boss_of_bind:
boss_of_bind.reap(pid, exit_status)
# don't do anything...
# the Python signal handler has been set up to write
# down a pipe, waking up our select() bit
pass
def get_signame(signal_number):
"""Return the symbolic name for a signal."""
......@@ -377,6 +371,17 @@ if __name__ == "__main__":
elif fd == wakeup_fd:
os.read(wakeup_fd, 32)
# clean up any processes that exited
while True:
try:
(pid, exit_status) = os.waitpid(-1, os.WNOHANG)
except OSError as o:
if o.errno == errno.ECHILD: break
# XXX: should be impossible to get any other error here
raise
if pid == 0: break
boss_of_bind.reap(pid, exit_status)
boss_of_bind.restart_processes()
# shutdown
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment