BIND 10 master, updated. ead42e5f5189b6fbd72823d6931eddff10409d9a [1673] Add ChangeLog entry

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Mar 8 04:02:54 UTC 2012


The branch, master has been updated
       via  ead42e5f5189b6fbd72823d6931eddff10409d9a (commit)
       via  3adabc6a1ece55ee01bc5b0d6aee8aebca2510d2 (commit)
       via  1cd0d0e4fc9324bbe7f8593478e2396d06337b1e (commit)
      from  14d4b5dd3ef4cb9cee473e70aaeaa5d63dac6113 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ead42e5f5189b6fbd72823d6931eddff10409d9a
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Mar 7 09:54:07 2012 +0530

    [1673] Add ChangeLog entry

commit 3adabc6a1ece55ee01bc5b0d6aee8aebca2510d2
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Mar 7 09:52:50 2012 +0530

    [1673] Output the signal name even when the process dumps core

commit 1cd0d0e4fc9324bbe7f8593478e2396d06337b1e
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Mar 5 20:48:12 2012 +0530

    [1673] Decode exit status in boss

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                              |    5 ++++
 doc/guide/bind10-messages.xml          |    2 +-
 src/bin/bind10/bind10_messages.mes     |    2 +-
 src/lib/python/isc/bind10/component.py |   34 +++++++++++++++++++++++++++++++-
 4 files changed, 40 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 4ea81f3..0069bd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+397.	[func]		muks
+	The boss process now gives more helpful description when a
+	sub-process exits due to a signal.
+	(Trac #1673, git 1cd0d0e4fc9324bbe7f8593478e2396d06337b1e)
+
 396.	[func]*		jinmei
 	libdatasrc: change the return type of ZoneFinder::find() so it can
 	contain more context of the search, which can be used for
diff --git a/doc/guide/bind10-messages.xml b/doc/guide/bind10-messages.xml
index fecefd0..b0cbb26 100644
--- a/doc/guide/bind10-messages.xml
+++ b/doc/guide/bind10-messages.xml
@@ -598,7 +598,7 @@ needs a dedicated message bus.
 </varlistentry>
 
 <varlistentry id="BIND10_COMPONENT_FAILED">
-<term>BIND10_COMPONENT_FAILED component %1 (pid %2) failed with %3 exit status</term>
+<term>BIND10_COMPONENT_FAILED component %1 (pid %2) failed: %3</term>
 <listitem><para>
 The process terminated, but the bind10 boss didn't expect it to, which means
 it must have failed.
diff --git a/src/bin/bind10/bind10_messages.mes b/src/bin/bind10/bind10_messages.mes
index 79635fd..3dd938f 100644
--- a/src/bin/bind10/bind10_messages.mes
+++ b/src/bin/bind10/bind10_messages.mes
@@ -24,7 +24,7 @@ needs a dedicated message bus.
 An error was encountered when the boss module specified
 statistics data which is invalid for the boss specification file.
 
-% BIND10_COMPONENT_FAILED component %1 (pid %2) failed with %3 exit status
+% BIND10_COMPONENT_FAILED component %1 (pid %2) failed: %3
 The process terminated, but the bind10 boss didn't expect it to, which means
 it must have failed.
 
diff --git a/src/lib/python/isc/bind10/component.py b/src/lib/python/isc/bind10/component.py
index 091bfee..b854743 100644
--- a/src/lib/python/isc/bind10/component.py
+++ b/src/lib/python/isc/bind10/component.py
@@ -30,6 +30,8 @@ configuration). This is yet to be designed.
 import isc.log
 from isc.log_messages.bind10_messages import *
 import time
+import os
+import signal
 
 logger = isc.log.Logger("boss")
 DBG_TRACE_DATA = 20
@@ -45,6 +47,14 @@ STATE_DEAD = 'dead'
 STATE_STOPPED = 'stopped'
 STATE_RUNNING = 'running'
 
+def get_signame(signal_number):
+    """Return the symbolic name for a signal."""
+    for sig in dir(signal):
+        if sig.startswith("SIG") and sig[3].isalnum():
+            if getattr(signal, sig) == signal_number:
+                return sig
+    return "unknown signal"
+
 class BaseComponent:
     """
     This represents a single component. This one is an abstract base class.
@@ -206,8 +216,30 @@ class BaseComponent:
                 it is considered a core or needed component, or because
                 the component is to be restarted later.
         """
+
+        if exit_code is not None:
+            if os.WIFEXITED(exit_code):
+                exit_str = "process exited normally with exit status %d" % (exit_code)
+            elif os.WIFCONTINUED(exit_code):
+                exit_str = "process continued with exit status %d" % (exit_code)
+            elif os.WIFSTOPPED(exit_code):
+                sig = os.WSTOPSIG(exit_code)
+                signame = get_signame(sig)
+                exit_str = "process stopped with exit status %d (killed by signal %d: %s)" % (exit_code, sig, signame)
+            elif os.WIFSIGNALED(exit_code):
+                sig = os.WTERMSIG(exit_code)
+                signame = get_signame(sig)
+                if os.WCOREDUMP(exit_code):
+                    exit_str = "process dumped core with exit status %d (killed by signal %d: %s)" % (exit_code, sig, signame)
+                else:
+                    exit_str = "process terminated with exit status %d (killed by signal %d: %s)" % (exit_code, sig, signame)
+            else:
+                exit_str = "unknown condition with exit status %d" % (exit_code)
+        else:
+            exit_str = "unknown condition"
+
         logger.error(BIND10_COMPONENT_FAILED, self.name(), self.pid(),
-                     exit_code if exit_code is not None else "unknown")
+                     exit_str)
         if not self.running():
             raise ValueError("Can't fail component that isn't running")
         self.__state = STATE_STOPPED



More information about the bind10-changes mailing list