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 - Read msgq configuration from configuration manager
- Provide more administrator options: - Provide more administrator options:
- Get process list - Get process list
...@@ -12,3 +11,4 @@ ...@@ -12,3 +11,4 @@
- Back-off mechanism for restarting failed processes - Back-off mechanism for restarting failed processes
- Start statistics daemon - Start statistics daemon
- Statistics interaction (?) - Statistics interaction (?)
- Stop using poll(), as primitive operating systems (OS X) don't support it
...@@ -112,7 +112,7 @@ class BoB: ...@@ -112,7 +112,7 @@ class BoB:
while self.cc_session is None: while self.cc_session is None:
# if we have been trying for "a while" give up # if we have been trying for "a while" give up
if (time.time() - cc_connect_start) > 5: if (time.time() - cc_connect_start) > 5:
c_channel.kill() c_channel.process.kill()
return "Unable to connect to c-channel after 5 seconds" return "Unable to connect to c-channel after 5 seconds"
# try to connect, and if we can't wait a short while # try to connect, and if we can't wait a short while
try: try:
...@@ -279,16 +279,10 @@ class BoB: ...@@ -279,16 +279,10 @@ class BoB:
if __name__ == "__main__": if __name__ == "__main__":
def reaper(signal_number, stack_frame): def reaper(signal_number, stack_frame):
"""A child process has died (SIGCHLD received).""" """A child process has died (SIGCHLD received)."""
global boss_of_bind # don't do anything...
while True: # the Python signal handler has been set up to write
try: # down a pipe, waking up our select() bit
(pid, exit_status) = os.waitpid(-1, os.WNOHANG) pass
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)
def get_signame(signal_number): def get_signame(signal_number):
"""Return the symbolic name for a signal.""" """Return the symbolic name for a signal."""
...@@ -377,6 +371,17 @@ if __name__ == "__main__": ...@@ -377,6 +371,17 @@ if __name__ == "__main__":
elif fd == wakeup_fd: elif fd == wakeup_fd:
os.read(wakeup_fd, 32) 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() boss_of_bind.restart_processes()
# shutdown # 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