Browse Source

Change shutdown to actually SIGKILL properly.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1675 e5f2f494-b856-4b98-b285-d166d9295462
Shane Kerr 15 years ago
parent
commit
37966187e0
1 changed files with 16 additions and 16 deletions
  1. 16 16
      src/bin/bind10/bind10.py.in

+ 16 - 16
src/bin/bind10/bind10.py.in

@@ -363,7 +363,6 @@ class BoB:
         self.reap_children()
         # next try sending a SIGTERM
         processes_to_stop = list(self.processes.values())
-        unstopped_processes = []
         for proc_info in processes_to_stop:
             if self.verbose:
                 sys.stdout.write("Sending SIGTERM to %s (PID %d).\n" % 
@@ -374,21 +373,22 @@ class BoB:
                 # ignore these (usually ESRCH because the child
                 # finally exited)
                 pass
-        # XXX: some delay probably useful... how much is uncertain
-        time.sleep(0.1)  
-        self.reap_children()
-        # finally, send a SIGKILL (unmaskable termination)
-        processes_to_stop = unstopped_processes
-        for proc_info in processes_to_stop:
-            if self.verbose:
-                sys.stdout.write("Sending SIGKILL to %s (PID %d).\n" % 
-                                 (proc_info.name, proc_info.pid))
-            try:
-                proc_info.process.kill()
-            except OSError:
-                # ignore these (usually ESRCH because the child
-                # finally exited)
-                pass
+        # finally, send SIGKILL (unmaskable termination) until everybody dies
+        while self.processes:
+            # XXX: some delay probably useful... how much is uncertain
+            time.sleep(0.1)  
+            self.reap_children()
+            processes_to_stop = list(self.processes.values())
+            for proc_info in processes_to_stop:
+                if self.verbose:
+                    sys.stdout.write("Sending SIGKILL to %s (PID %d).\n" % 
+                                     (proc_info.name, proc_info.pid))
+                try:
+                    proc_info.process.kill()
+                except OSError:
+                    # ignore these (usually ESRCH because the child
+                    # finally exited)
+                    pass
         if self.verbose:
             sys.stdout.write("All processes ended, server done.\n")