BIND 10 trac2205, updated. 0582539b207817d0ab63a2f07923d9cd69b520a7 [2205] reordered log messages
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Oct 17 23:19:12 UTC 2012
The branch, trac2205 has been updated
via 0582539b207817d0ab63a2f07923d9cd69b520a7 (commit)
via 59ca62327546854c22cf8caae902f023a79f3272 (commit)
via f34ff8e2e66798f4dc2fc63d1aeb4c198431beb1 (commit)
via d5afffd2e3db401cafb5ac2ca80215afffddf7da (commit)
via 949aded6b4682df0f07e78cd4620df303f789236 (commit)
via c2608e7b395881e9953962d923dfd1de6eb50f5f (commit)
from 4b2997b783ed2f9a29842735dad130cfdb41e38a (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 0582539b207817d0ab63a2f07923d9cd69b520a7
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Oct 17 16:18:54 2012 -0700
[2205] reordered log messages
commit 59ca62327546854c22cf8caae902f023a79f3272
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Oct 17 16:17:39 2012 -0700
[2205] tried to improve what() message of some test exceptions
commit f34ff8e2e66798f4dc2fc63d1aeb4c198431beb1
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Oct 17 16:15:10 2012 -0700
[2205] clarify the accessibility of DataSrcClientsBuilderBase
commit d5afffd2e3db401cafb5ac2ca80215afffddf7da
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Oct 17 16:12:50 2012 -0700
[2205] logged really unexpected exception in manager's dtor.
commit 949aded6b4682df0f07e78cd4620df303f789236
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Oct 17 16:05:51 2012 -0700
[2205] some wording fixes in-code documentation
commit c2608e7b395881e9953962d923dfd1de6eb50f5f
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Oct 17 15:56:27 2012 -0700
[2205] avoid referencing post-destructor member variables.
by a bit ugly hack: we specialize some part of the destructor and make
a local copy of these variables so the tests can inspect them later.
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/auth_messages.mes | 74 +++++++++++++-----------
src/bin/auth/datasrc_clients_mgr.h | 27 ++++++---
src/bin/auth/tests/test_datasrc_clients_mgr.cc | 27 ++++++++-
src/bin/auth/tests/test_datasrc_clients_mgr.h | 18 +++++-
4 files changed, 102 insertions(+), 44 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_messages.mes b/src/bin/auth/auth_messages.mes
index f5253e6..aa40c8a 100644
--- a/src/bin/auth/auth_messages.mes
+++ b/src/bin/auth/auth_messages.mes
@@ -57,6 +57,47 @@ At attempt to update the configuration the server with information
from the configuration database has failed, the reason being given in
the message.
+% AUTH_DATASRC_CLIENTS_BUILDER_COMMAND data source builder received command: %1
+A debug message, showing when the separate thread for maintaining data
+source clients receives a command from the manager.
+
+% AUTH_DATASRC_CLIENTS_BUILDER_FAILED data source builder thread stopped due to an exception: %1
+The separate thread for maintaining data source clients has been
+terminated due to some uncaught exception. The manager cannot always
+catch this condition in timely fashion, and there is no way to recover
+from this situation except for restarting the entire server. So this
+message needs to be carefully watched, and should it occur the auth
+server needs to be restarted by hand.
+
+% AUTH_DATASRC_CLIENTS_BUILDER_FAILED_UNEXPECTED data source builder thread stopped due to an unexpected exception
+This is similar to AUTH_DATASRC_CLIENTS_BUILDER_FAILED, but the
+exception type is even more unexpected. This may rather indicate some
+run time failure than program errors, but in any case the server needs
+to be restarted by hand.
+
+% AUTH_DATASRC_CLIENTS_BUILDER_STARTED data source builder thread started
+A separate thread for maintaining data source clients has been started.
+
+% AUTH_DATASRC_CLIENTS_BUILDER_STOPPED data source builder thread stopped
+The separate thread for maintaining data source clients has been stopped.
+
+% AUTH_DATASRC_CLIENTS_SHUTDOWN_ERROR error on waiting for data source builder thread: %1
+This indicates that the separate thread for maintaining data source
+clients had been terminated due to an uncaught exception, and the
+manager notices that at its own termination. There should have been
+AUTH_DATASRC_CLIENTS_BUILDER_FAILED or
+AUTH_DATASRC_CLIENTS_BUILDER_FAILED_UNEXPECTED error messages in past
+logs. If this message appears, the maintenance of the data source
+clients hasn't been working properly for some time.
+
+% AUTH_DATASRC_CLIENTS_SHUTDOWN_UNEXPECTED_ERROR Unexpected error on waiting for data source builder thread
+Some exception happens while waiting for the termination of the
+separate thread for maintaining data source clients. This shouldn't
+happen in normal conditions; it should be either fatal system level
+errors such as severe memory shortage or some internal bug. If that
+happens, and if it's not in the middle of terminating b10-auth, it's
+probably better to stop and restart it.
+
% AUTH_DATA_SOURCE data source database file: %1
This is a debug message produced by the authoritative server when it accesses a
datebase data source, listing the file that is being accessed.
@@ -268,36 +309,3 @@ This is a debug message output during the processing of a NOTIFY
request. The zone manager component has been informed of the request,
but has returned an error response (which is included in the message). The
NOTIFY request will not be honored.
-
-% AUTH_DATASRC_CLIENTS_BUILDER_STARTED data source builder thread started
-A separate thread for maintaining data source clients has been started.
-
-% AUTH_DATASRC_CLIENTS_BUILDER_STOPPED data source builder thread stopped
-The separate thread for maintaining data source clients has been stopped.
-
-% AUTH_DATASRC_CLIENTS_BUILDER_COMMAND data source builder received command: %1
-A debug message, showing when the separate thread for maintaining data
-source clients receives a command from the manager.
-
-% AUTH_DATASRC_CLIENTS_BUILDER_FAILED data source builder thread stopped due to an exception: %1
-The separate thread for maintaining data source clients has been
-terminated due to some uncaught exception. The manager cannot always
-catch this condition in timely fashion, and there is no way to recover
-from this situation except for restarting the entire server. So this
-message needs to be carefully watched, and should it occur the auth
-server needs to be restarted by hand.
-
-% AUTH_DATASRC_CLIENTS_BUILDER_FAILED_UNEXPECTED data source builder thread stopped due to an unexpected exception
-This is similar to AUTH_DATASRC_CLIENTS_BUILDER_FAILED, but the
-exception type is even more unexpected. This may rather indicate some
-run time failure than program errors, but in any case the server needs
-to be restarted by hand.
-
-% AUTH_DATASRC_CLIENTS_SHUTDOWN_ERROR error on waiting for data source builder thread: %1
-This indicates that the separate thread for maintaining data source
-clients had been terminated due to an uncaught exception, and the
-manager notices that at its own termination. There should have been
-AUTH_DATASRC_CLIENTS_BUILDER_FAILED or
-AUTH_DATASRC_CLIENTS_BUILDER_FAILED_UNEXPECTED error messages in past
-logs. If this message appears, the maintenance of the data source
-clients hasn't been working properly for some time.
diff --git a/src/bin/auth/datasrc_clients_mgr.h b/src/bin/auth/datasrc_clients_mgr.h
index c3bf1d2..c8191c3 100644
--- a/src/bin/auth/datasrc_clients_mgr.h
+++ b/src/bin/auth/datasrc_clients_mgr.h
@@ -111,8 +111,9 @@ public:
// We share class member variables with the builder, which will be
// invalidated after the call to the destructor, so we need to make
// sure the builder thread is terminated. Depending on the timing
- // this could time; if we don't want that to happen in this context,
- // we may want to introduce a separate 'shutdown()' method.
+ // this could take a long time; if we don't want that to happen in
+ // this context, we may want to introduce a separate 'shutdown()'
+ // method.
// Also, since we don't want to propagate exceptions from a destructor,
// we catch any possible ones. In fact the only really expected one
// is Thread::UncaughtException when the builder thread died due to
@@ -127,10 +128,21 @@ public:
// simply let it go through.
LOG_ERROR(auth_logger, AUTH_DATASRC_CLIENTS_SHUTDOWN_ERROR).
arg(ex.what());
- } catch (...) {}
+ } catch (...) {
+ LOG_ERROR(auth_logger,
+ AUTH_DATASRC_CLIENTS_SHUTDOWN_UNEXPECTED_ERROR);
+ }
+
+ cleanup(); // see below
}
private:
+ // This is expected to be called at the end of the destructor. It
+ // actually does nothing, but provides a customization point for
+ // specialized class for tests so that the tests can inspect the last
+ // state of the class.
+ void cleanup() {}
+
void sendCommand(datasrc_clientmgr_internal::CommandID command,
data::ConstElementPtr arg) {
{
@@ -163,13 +175,14 @@ namespace datasrc_clientmgr_internal {
///
/// An object of this class is supposed to run on a dedicated thread, whose
/// main function is a call to its \c run() method. It runs in a loop
-/// waiting for commands from the manager and handle each command (including
+/// waiting for commands from the manager and handles each command (including
/// reloading a new version of zone data into memory or fully reconfiguration
-/// of specific set of data source clients. When it receives a SHUTDOWN
+/// of specific set of data source clients). When it receives a SHUTDOWN
/// command, it exits from the loop, which will terminate the thread.
///
-/// This class is a server of \c DataSrcClientsMgr. Except for tests,
-/// applications should not directly access to this class.
+/// While this class is defined in a publicly visible namespace, it's
+/// essentially private to \c DataSrcClientsMgr. Except for tests,
+/// applications should not directly access this class.
///
/// This class is templated so that we can test it without involving actual
/// threads or locks.
diff --git a/src/bin/auth/tests/test_datasrc_clients_mgr.cc b/src/bin/auth/tests/test_datasrc_clients_mgr.cc
index 7d114ae..72979b4 100644
--- a/src/bin/auth/tests/test_datasrc_clients_mgr.cc
+++ b/src/bin/auth/tests/test_datasrc_clients_mgr.cc
@@ -23,8 +23,11 @@ namespace datasrc_clientmgr_internal {
// Define static DataSrcClientsBuilder member variables.
bool FakeDataSrcClientsBuilder::started = false;
std::list<Command>* FakeDataSrcClientsBuilder::command_queue = NULL;
+std::list<Command> FakeDataSrcClientsBuilder::command_queue_copy;
TestCondVar* FakeDataSrcClientsBuilder::cond = NULL;
+TestCondVar FakeDataSrcClientsBuilder::cond_copy;
TestMutex* FakeDataSrcClientsBuilder::queue_mutex = NULL;
+TestMutex FakeDataSrcClientsBuilder::queue_mutex_copy;
bool FakeDataSrcClientsBuilder::thread_waited = false;
FakeDataSrcClientsBuilder::ExceptionFromWait
FakeDataSrcClientsBuilder::thread_throw_on_wait =
@@ -43,9 +46,29 @@ TestDataSrcClientsBuilder::doNoop() {
throw 42;
}
}
+} // namespace datasrc_clientmgr_internal
+
+template<>
+void
+TestDataSrcClientsMgr::cleanup() {
+ using namespace datasrc_clientmgr_internal;
+ // Make copy of some of the manager's member variables and reset the
+ // corresponding pointers. The currently pointed objects are in the
+ // manager object, which are going to be invalidated.
+
+ FakeDataSrcClientsBuilder::command_queue_copy = command_queue_;
+ FakeDataSrcClientsBuilder::command_queue =
+ &FakeDataSrcClientsBuilder::command_queue_copy;
+ FakeDataSrcClientsBuilder::queue_mutex_copy = queue_mutex_;
+ FakeDataSrcClientsBuilder::queue_mutex =
+ &FakeDataSrcClientsBuilder::queue_mutex_copy;
+ FakeDataSrcClientsBuilder::cond_copy = cond_;
+ FakeDataSrcClientsBuilder::cond =
+ &FakeDataSrcClientsBuilder::cond_copy;
}
-}
-}
+
+} // namespace auth
+} // namespace isc
// Local Variables:
// mode: c++
diff --git a/src/bin/auth/tests/test_datasrc_clients_mgr.h b/src/bin/auth/tests/test_datasrc_clients_mgr.h
index 911e722..99dc53e 100644
--- a/src/bin/auth/tests/test_datasrc_clients_mgr.h
+++ b/src/bin/auth/tests/test_datasrc_clients_mgr.h
@@ -124,9 +124,14 @@ public:
static bool started;
// These three correspond to the resource shared with the manager.
+ // xxx_copy will be set in the manager's destructor to record the
+ // final state of the manager.
static std::list<Command>* command_queue;
static TestCondVar* cond;
static TestMutex* queue_mutex;
+ static std::list<Command> command_queue_copy;
+ static TestCondVar cond_copy;
+ static TestMutex queue_mutex_copy;
// true iff the manager waited on the thread running the builder.
static bool thread_waited;
@@ -167,9 +172,11 @@ public:
case FakeDataSrcClientsBuilder::NOTHROW:
break;
case FakeDataSrcClientsBuilder::THROW_UNCAUGHT_EX:
- isc_throw(util::thread::Thread::UncaughtException, "for test");
+ isc_throw(util::thread::Thread::UncaughtException,
+ "TestThread wait() saw an exception");
case FakeDataSrcClientsBuilder::THROW_OTHER:
- isc_throw(Unexpected, "for test");
+ isc_throw(Unexpected,
+ "General emulated failure in TestThread wait()");
}
}
};
@@ -182,6 +189,13 @@ typedef DataSrcClientsMgrBase<
datasrc_clientmgr_internal::TestMutex,
datasrc_clientmgr_internal::TestCondVar> TestDataSrcClientsMgr;
+// A specialization of manager's "cleanup" called at the end of the
+// destructor. We use this to record the final values of some of the class
+// member variables.
+template<>
+void
+TestDataSrcClientsMgr::cleanup();
+
} // namespace auth
} // namespace isc
More information about the bind10-changes
mailing list