Commit 246a87a4 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2211] let the thread abort if it sees an unexpected exception, rather rethrow.

update the test case and log message accordingly.
parent 113201b7
......@@ -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
......
......@@ -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);
}
}
......
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment