BIND 10 trac2211, updated. 246a87a4a681a574a0ecff9b26a49e471a60138a [2211] let the thread abort if it sees an unexpected exception, rather rethrow.
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Oct 23 16:49:40 UTC 2012
The branch, trac2211 has been updated
via 246a87a4a681a574a0ecff9b26a49e471a60138a (commit)
via 113201b72be892ffd8af815806ccbb0e14ad6b67 (commit)
via a8dcc73698a14603967aec4dfb09e183e559f84a (commit)
from bb59b815c94d86c6d5d34cdfd707b7e6e3522122 (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 246a87a4a681a574a0ecff9b26a49e471a60138a
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Tue Oct 23 09:48:08 2012 -0700
[2211] let the thread abort if it sees an unexpected exception, rather rethrow.
update the test case and log message accordingly.
commit 113201b72be892ffd8af815806ccbb0e14ad6b67
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Tue Oct 23 09:37:19 2012 -0700
[2211] s/swapDataSrcClientLists/setDataSrcClientLists/ and changed the behavior
the users of this method only need the set behavior, and the previous code
actually didn't swap them as expected anyway.
commit a8dcc73698a14603967aec4dfb09e183e559f84a
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Tue Oct 23 09:30:48 2012 -0700
[2211] style fixes to test JSON configs
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/auth_messages.mes | 9 ++++-----
src/bin/auth/benchmarks/query_bench.cc | 6 +++---
src/bin/auth/datasrc_clients_mgr.h | 10 +++++-----
src/bin/auth/tests/auth_srv_unittest.cc | 6 +++---
src/bin/auth/tests/command_unittest.cc | 2 +-
.../auth/tests/datasrc_clients_builder_unittest.cc | 8 +++++---
src/bin/auth/tests/datasrc_clients_mgr_unittest.cc | 16 ++++++++--------
src/bin/auth/tests/datasrc_config_unittest.cc | 6 +++---
8 files changed, 32 insertions(+), 31 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_messages.mes b/src/bin/auth/auth_messages.mes
index 55682d2..07bcd8f 100644
--- a/src/bin/auth/auth_messages.mes
+++ b/src/bin/auth/auth_messages.mes
@@ -107,11 +107,10 @@ 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.
+manager notices that at its own termination. This is not an expected
+event, because the thread is implemented so it catches all exceptions
+internally. So, if this message is logged it's most likely some internal
+bug, and it would be nice to file a bug report.
% 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
diff --git a/src/bin/auth/benchmarks/query_bench.cc b/src/bin/auth/benchmarks/query_bench.cc
index 2bc674d..77b3377 100644
--- a/src/bin/auth/benchmarks/query_bench.cc
+++ b/src/bin/auth/benchmarks/query_bench.cc
@@ -127,9 +127,9 @@ public:
OutputBuffer& buffer) :
QueryBenchMark(queries, query_message, buffer)
{
- // Note: swapDataSrcClientLists() may be deprecated, but until then
+ // Note: setDataSrcClientLists() may be deprecated, but until then
// we use it because we want to be synchronized with the server.
- server_->getDataSrcClientsMgr().swapDataSrcClientLists(
+ server_->getDataSrcClientsMgr().setDataSrcClientLists(
configureDataSource(
Element::fromJSON("{\"IN\":"
" [{\"type\": \"sqlite3\","
@@ -148,7 +148,7 @@ public:
OutputBuffer& buffer) :
QueryBenchMark(queries, query_message, buffer)
{
- server_->getDataSrcClientsMgr().swapDataSrcClientLists(
+ server_->getDataSrcClientsMgr().setDataSrcClientLists(
configureDataSource(
Element::fromJSON("{\"IN\":"
" [{\"type\": \"MasterFiles\","
diff --git a/src/bin/auth/datasrc_clients_mgr.h b/src/bin/auth/datasrc_clients_mgr.h
index 1d5c17c..4d66006 100644
--- a/src/bin/auth/datasrc_clients_mgr.h
+++ b/src/bin/auth/datasrc_clients_mgr.h
@@ -219,14 +219,14 @@ public:
reconfigureHook(); // for test's customization
}
- /// \brief Swap the underlying data source client lists.
+ /// \brief Set the underlying data source client lists to new lists.
///
/// This is provided only for some existing tests until we support a
/// cleaner way to use faked data source clients. Non test code or
/// newer tests must not use this.
- void swapDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) {
+ void setDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) {
typename MutexType::Locker locker(map_mutex_);
- clients_map_.swap(new_lists);
+ clients_map_ = new_lists;
}
private:
@@ -384,10 +384,10 @@ DataSrcClientsBuilderBase<MutexType, CondVarType>::run() {
// We explicitly catch exceptions so we can log it as soon as possible.
LOG_ERROR(auth_logger, AUTH_DATASRC_CLIENTS_BUILDER_FAILED).
arg(ex.what());
- throw;
+ assert(false);
} catch (...) {
LOG_ERROR(auth_logger, AUTH_DATASRC_CLIENTS_BUILDER_FAILED_UNEXPECTED);
- throw;
+ assert(false);
}
}
diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc
index e94dbf6..5d224c3 100644
--- a/src/bin/auth/tests/auth_srv_unittest.cc
+++ b/src/bin/auth/tests/auth_srv_unittest.cc
@@ -730,7 +730,7 @@ installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) {
// For now, we use explicit swap than reconfigure() because the latter
// involves a separate thread and cannot guarantee the new config is
// available for the subsequent test.
- server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+ server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
}
void
@@ -1447,7 +1447,7 @@ TEST_F(AuthSrvTest,
}
DataSrcClientListsPtr lists(new std::map<RRClass, ListPtr>);
lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
- server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+ server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
createDataFromFile("nsec3query_nodnssec_fromWire.wire");
server.processMessage(*io_message, *parse_message, *response_obuffer,
@@ -1479,7 +1479,7 @@ setupThrow(AuthSrv& server, ThrowWhen throw_when, bool isc_exception,
}
DataSrcClientListsPtr lists(new std::map<RRClass, ListPtr>);
lists->insert(pair<RRClass, ListPtr>(RRClass::IN(), list));
- mgr.swapDataSrcClientLists(lists);
+ mgr.setDataSrcClientLists(lists);
}
TEST_F(AuthSrvTest,
diff --git a/src/bin/auth/tests/command_unittest.cc b/src/bin/auth/tests/command_unittest.cc
index 3e201e8..795d9a2 100644
--- a/src/bin/auth/tests/command_unittest.cc
+++ b/src/bin/auth/tests/command_unittest.cc
@@ -193,7 +193,7 @@ zoneChecks(AuthSrv& server) {
void
installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) {
- server.getDataSrcClientsMgr().swapDataSrcClientLists(lists);
+ server.getDataSrcClientsMgr().setDataSrcClientLists(lists);
}
void
diff --git a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
index ff39b95..79fd3e3 100644
--- a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
+++ b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
@@ -71,14 +71,16 @@ TEST_F(DataSrcClientsBuilderTest, runMultiCommands) {
TEST_F(DataSrcClientsBuilderTest, exception) {
// Let the noop command handler throw exceptions and see if we can see
- // them.
+ // them. Right now, we simply abort to prevent the system from running
+ // with half-broken state. Eventually we should introduce a better
+ // error handling.
command_queue.push_back(noop_cmd);
queue_mutex.throw_from_noop = TestMutex::EXCLASS;
- EXPECT_THROW(builder.run(), isc::Exception);
+ EXPECT_DEATH_IF_SUPPORTED({builder.run();}, "");
command_queue.push_back(noop_cmd);
queue_mutex.throw_from_noop = TestMutex::INTEGER;
- EXPECT_THROW(builder.run(), int);
+ EXPECT_DEATH_IF_SUPPORTED({builder.run();}, "");
}
TEST_F(DataSrcClientsBuilderTest, condWait) {
diff --git a/src/bin/auth/tests/datasrc_clients_mgr_unittest.cc b/src/bin/auth/tests/datasrc_clients_mgr_unittest.cc
index a5d4928..7d1eb4d 100644
--- a/src/bin/auth/tests/datasrc_clients_mgr_unittest.cc
+++ b/src/bin/auth/tests/datasrc_clients_mgr_unittest.cc
@@ -118,8 +118,8 @@ TEST(DataSrcClientsMgrTest, reconfigure) {
// A valid reconfigure argument
ConstElementPtr reconfigure_arg = Element::fromJSON(
- "{" "\"IN\": [{\"type\": \"MasterFiles\", \"params\": {},"
- " \"cache-enable\": true}]}");
+ "{""\"IN\": [{\"type\": \"MasterFiles\", \"params\": {},"
+ " \"cache-enable\": true}]}");
// On reconfigure(), it just send the RECONFIGURE command to the builder
// thread with the given argument intact.
@@ -165,10 +165,10 @@ TEST(DataSrcClientsMgrTest, holder) {
// Put something in, that should become visible.
ConstElementPtr reconfigure_arg = Element::fromJSON(
- "{" "\"IN\": [{\"type\": \"MasterFiles\", \"params\": {},"
- " \"cache-enable\": true}],"
- "\"CH\": [{\"type\": \"MasterFiles\", \"params\": {},"
- " \"cache-enable\": true}]}");
+ "{\"IN\": [{\"type\": \"MasterFiles\", \"params\": {},"
+ " \"cache-enable\": true}],"
+ " \"CH\": [{\"type\": \"MasterFiles\", \"params\": {},"
+ " \"cache-enable\": true}]}");
mgr.reconfigure(reconfigure_arg);
{
TestDataSrcClientsMgr::Holder holder(mgr);
@@ -181,8 +181,8 @@ TEST(DataSrcClientsMgrTest, holder) {
// Replace the lists with new lists containing only one list.
// The CH will disappear again.
reconfigure_arg = Element::fromJSON(
- "{" "\"IN\": [{\"type\": \"MasterFiles\", \"params\": {},"
- " \"cache-enable\": true}]}");
+ "{\"IN\": [{\"type\": \"MasterFiles\", \"params\": {},"
+ " \"cache-enable\": true}]}");
mgr.reconfigure(reconfigure_arg);
{
TestDataSrcClientsMgr::Holder holder(mgr);
diff --git a/src/bin/auth/tests/datasrc_config_unittest.cc b/src/bin/auth/tests/datasrc_config_unittest.cc
index e0046d6..b555aa6 100644
--- a/src/bin/auth/tests/datasrc_config_unittest.cc
+++ b/src/bin/auth/tests/datasrc_config_unittest.cc
@@ -77,8 +77,8 @@ datasrcConfigHandler(DatasrcConfigTest* fake_server, const std::string&,
class DatasrcConfigTest : public ::testing::Test {
public:
- void swapDataSrcClientLists(shared_ptr<std::map<dns::RRClass, ListPtr> >
- new_lists)
+ void setDataSrcClientLists(shared_ptr<std::map<dns::RRClass, ListPtr> >
+ new_lists)
{
lists_.clear(); // first empty it
@@ -161,7 +161,7 @@ testConfigureDataSource(DatasrcConfigTest& test,
// possible to easily look that they were called.
shared_ptr<std::map<dns::RRClass, ListPtr> > lists =
configureDataSourceGeneric<FakeList>(config);
- test.swapDataSrcClientLists(lists);
+ test.setDataSrcClientLists(lists);
}
// Push there a configuration with a single list.
More information about the bind10-changes
mailing list