2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

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
This commit is contained in:
Shane Kerr
2010-01-08 12:55:21 +00:00
parent 8b3bc064c7
commit b5d9864f28
2 changed files with 17 additions and 12 deletions

View File

@@ -1,4 +1,3 @@
- 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

View File

@@ -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