BIND 10 master, updated. ee0782b63e4972a3388db5367f7b79a3a1ba2984 Changelog
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jan 31 11:34:27 UTC 2012
The branch, master has been updated
via ee0782b63e4972a3388db5367f7b79a3a1ba2984 (commit)
via 49ac4659f15c443e483922bf9c4f2de982bae25d (commit)
via 35b589adb440f744d15a077855f7882df5b9e8c9 (commit)
via 32f93f7158f1291d24960eedf199e6a5e9a9fc98 (commit)
via 6868aeaa6c5e5404a783c65dd6e7dad30a843305 (commit)
via b0d52a6010210282915fa8defa027b6cf1f0e36b (commit)
via 058f2664b387c531920c6068b29cee34fc966a05 (commit)
from fdf120001f60678e573b8c398a45a74256bf3374 (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 ee0782b63e4972a3388db5367f7b79a3a1ba2984
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Jan 31 12:21:11 2012 +0100
Changelog
commit 49ac4659f15c443e483922bf9c4f2de982bae25d
Merge: fdf120001f60678e573b8c398a45a74256bf3374 35b589adb440f744d15a077855f7882df5b9e8c9
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Jan 31 12:18:12 2012 +0100
Merge branch 'work/abortsocket'
commit 35b589adb440f744d15a077855f7882df5b9e8c9
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Jan 30 16:18:54 2012 +0100
[1543] Have catch on the same line as }
As it is tightly coupled with the previous try statement.
commit 32f93f7158f1291d24960eedf199e6a5e9a9fc98
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Jan 30 16:15:45 2012 +0100
[1543] Don't identify with the server
The server is a separate entity from the developer's collective mind,
which, at last for the time being, is not considered sentient. Therefore
the word "we" is not appropriate and the server should be described in
third person.
commit 6868aeaa6c5e5404a783c65dd6e7dad30a843305
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 19:45:24 2012 +0100
[1543] Check it aborts on errors from releaseSocket
It happens to work already.
commit b0d52a6010210282915fa8defa027b6cf1f0e36b
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 19:31:36 2012 +0100
[1543] Abort on problem requesting a socket
If it is not one of the "known to be OK" exceptions, we abort.
commit 058f2664b387c531920c6068b29cee34fc966a05
Merge: 49752533bcb8680e8633161230b89e990efcee58 37c946ce22e15183167033b147ac20c1c94c33fc
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 18:48:53 2012 +0100
Merge branch 'master' into #1543
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 +++-
src/lib/server_common/portconfig.cc | 18 ++++++--
src/lib/server_common/server_common_messages.mes | 16 +++++++
src/lib/server_common/tests/portconfig_unittest.cc | 44 +++++++++++++++++++-
src/lib/testutils/socket_request.h | 30 +++++++++++---
5 files changed, 103 insertions(+), 13 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 0e11042..14eb4ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,15 @@
+372. [func] vorner
+ When the allocation of a socket fails for a different reason than the
+ socket not being provided by the OS, the b10-auth and b10-resolver abort,
+ as the system might be in inconsistent state after such error.
+ (Trac #1543, git 49ac4659f15c443e483922bf9c4f2de982bae25d)
+
371. [bug] jelte
The new query handling module of b10-auth (currently only used with
the in-memory data source) now correctly includes the DS record (or
the denial of its existence if NSEC is used) when returning a
delegation from a signed zone.
- (Trac #1573, bd7a3ac98177573263950303d4b2ea7400781d0f)
+ (Trac #1573, git bd7a3ac98177573263950303d4b2ea7400781d0f)
370. [func] jinmei
libdns++: a new class NSEC3Hash was introduced as a utility for
diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc
index 556f0da..5c9a7fe 100644
--- a/src/lib/server_common/portconfig.cc
+++ b/src/lib/server_common/portconfig.cc
@@ -64,8 +64,7 @@ parseAddresses(isc::data::ConstElementPtr addresses,
}
result.push_back(AddressPair(addr->stringValue(),
port->intValue()));
- }
- catch (const TypeError&) { // Better error message
+ } catch (const TypeError&) { // Better error message
LOG_ERROR(logger, SRVCOMM_ADDRESS_TYPE).
arg(addrPair->str());
isc_throw(TypeError,
@@ -135,8 +134,7 @@ installListenAddresses(const AddressList& newAddresses,
}
setAddresses(service, newAddresses);
addressStore = newAddresses;
- }
- catch (const exception& e) {
+ } catch (const SocketRequestor::NonFatalSocketError& e) {
/*
* If one of the addresses isn't set successfully, we will restore
* the old addresses, the behavior is that either all address are
@@ -153,7 +151,7 @@ installListenAddresses(const AddressList& newAddresses,
LOG_ERROR(logger, SRVCOMM_ADDRESS_FAIL).arg(e.what());
try {
setAddresses(service, addressStore);
- } catch (const exception& e2) {
+ } catch (const SocketRequestor::NonFatalSocketError& e2) {
LOG_FATAL(logger, SRVCOMM_ADDRESS_UNRECOVERABLE).arg(e2.what());
// If we can't set the new ones, nor the old ones, at least
// releasing everything should work. If it doesn't, there isn't
@@ -164,6 +162,16 @@ installListenAddresses(const AddressList& newAddresses,
//Anyway the new configure has problem, we need to notify configure
//manager the new configure doesn't work
throw;
+ } catch (const exception& e) {
+ // Any other kind of exception is fatal. It might mean we are in
+ // inconsistent state with the boss/socket creator, so we abort
+ // to make sure it doesn't last.
+ LOG_FATAL(logger, SRVCOMM_EXCEPTION_ALLOC).arg(e.what());
+ abort();
+ } catch (...) {
+ // As the previous one, but we know even less info
+ LOG_FATAL(logger, SRVCOMM_UNKNOWN_EXCEPTION_ALLOC);
+ abort();
}
}
diff --git a/src/lib/server_common/server_common_messages.mes b/src/lib/server_common/server_common_messages.mes
index 0efe388..3b3090d 100644
--- a/src/lib/server_common/server_common_messages.mes
+++ b/src/lib/server_common/server_common_messages.mes
@@ -78,6 +78,22 @@ addresses we are going to listen on (eg. there will be one log message
per pair). This appears only after SRVCOMM_SET_LISTEN, but might
be hidden, as it has higher debug level.
+% SRVCOMM_EXCEPTION_ALLOC exception when allocating a socket: %1
+The process tried to allocate a socket using the socket creator, but an error
+occurred. But it is not one of the errors we are sure are "safe". In this case
+it is unclear if the unsuccessful communication left the process and the bind10
+process in inconsistent state, so the process is going to abort to prevent
+further problems in that area.
+
+This is probably a bug in the code, but it could be caused by other unusual
+conditions (like insufficient memory, deleted socket file used for
+communication).
+
+% SRVCOMM_UNKNOWN_EXCEPTION_ALLOC unknown exception when allocating a socket
+The situation is the same as in the SRVCOMM_EXCEPTION_ALLOC case, but further
+details about the error are unknown, because it was signaled by throwing
+something not being an exception. This is definitely a bug.
+
% SRVCOMM_KEYS_DEINIT deinitializing TSIG keyring
Debug message indicating that the server is deinitializing the TSIG keyring.
diff --git a/src/lib/server_common/tests/portconfig_unittest.cc b/src/lib/server_common/tests/portconfig_unittest.cc
index ee17e56..7605bc6 100644
--- a/src/lib/server_common/tests/portconfig_unittest.cc
+++ b/src/lib/server_common/tests/portconfig_unittest.cc
@@ -265,7 +265,7 @@ TEST_F(InstallListenAddresses, brokenRollback) {
sock_requestor_.given_tokens_.clear();
sock_requestor_.break_rollback_ = true;
EXPECT_THROW(installListenAddresses(invalid_, store_, dnss_),
- SocketRequestor::SocketError);
+ SocketRequestor::NonFatalSocketError);
// No addresses here
EXPECT_TRUE(store_.empty());
// The first pair should be requested in the first part of the failure to
@@ -295,4 +295,46 @@ TEST_F(InstallListenAddresses, brokenRollback) {
"released");
}
+// Make sure the death tests are filterable away.
+typedef InstallListenAddresses InstallListenAddressesDeathTest;
+
+// We make the socket requestor throw a "fatal" exception, one where we can't be
+// sure the state between processes is consistent. So we abort in that case.
+TEST_F(InstallListenAddressesDeathTest, inconsistent) {
+ AddressList deathAddresses;
+ deathAddresses.push_back(AddressPair("192.0.2.3", 5288));
+ // Make sure it actually kills the application (there should be an abort
+ // in this case)
+ EXPECT_DEATH({
+ try {
+ installListenAddresses(deathAddresses, store_, dnss_);
+ } catch (...) {
+ // Prevent exceptions killing the application, we need
+ // to make sure it dies the real hard way
+ };
+ }, "");
+}
+
+// If we are unable to tell the boss we closed a socket, we abort, as we are
+// not consistent with the boss most probably.
+TEST_F(InstallListenAddressesDeathTest, cantClose) {
+ installListenAddresses(valid_, store_, dnss_);
+ AddressList empty;
+ // Instruct it to fail on close
+ sock_requestor_.break_release_ = true;
+ EXPECT_DEATH({
+ try {
+ // Setting to empty will close all current sockets.
+ // And thanks to the break_release_, the close will
+ // throw, which will make it crash.
+ installListenAddresses(empty, store_, dnss_);
+ } catch (...) {
+ // To make sure it is killed by abort, not by some
+ // (unhandled) exception
+ };
+ }, "");
+ // And reset it back, so it can safely clean up itself.
+ sock_requestor_.break_release_ = false;
+}
+
}
diff --git a/src/lib/testutils/socket_request.h b/src/lib/testutils/socket_request.h
index c06c969..a1e51e2 100644
--- a/src/lib/testutils/socket_request.h
+++ b/src/lib/testutils/socket_request.h
@@ -62,8 +62,8 @@ public:
TestSocketRequestor(asiodns::DNSService& dnss,
server_common::portconfig::AddressList& store,
uint16_t expect_port) :
- last_token_(0), break_rollback_(false), dnss_(dnss), store_(store),
- expect_port_(expect_port)
+ last_token_(0), break_rollback_(false), break_release_(false),
+ dnss_(dnss), store_(store), expect_port_(expect_port)
{
// Prepare the requestor (us) for the test
server_common::initTestSocketRequestor(this);
@@ -106,11 +106,23 @@ public:
/// ::1 address is requested.
bool break_rollback_;
+ /// \brief Throw on releaseSocket
+ ///
+ /// If this is set to true, the releaseSocket will throw SocketError.
+ /// Defaults to false.
+ bool break_release_;
+
/// \brief Release a socket
///
/// This only stores the token passed.
/// \param token The socket to release
+ ///
+ /// \throw SocketError in case the break_release_ is set to true. This is
+ /// to test exception handling.
void releaseSocket(const std::string& token) {
+ if (break_release_) {
+ isc_throw(SocketError, "Fatal test socket error");
+ }
released_tokens_.push_back(token);
}
@@ -119,8 +131,9 @@ public:
/// This creates a new token and fakes a new socket and returns it.
/// The token is stored.
///
- /// In case the address is 192.0.2.2 or if the break_rollback_ is true
- /// and address is ::1, it throws.
+ /// In case the address is 192.0.2.2, it throws SocketAllocateError
+ /// or if the break_rollback_ is true and address is ::1, it throws
+ /// ShareError. If the address is 192.0.2.3, it throws SocketError.
///
/// The tokens produced are in form of protocol:address:port:fd. The fds
/// start at 1 and increase by each successfull call.
@@ -131,13 +144,18 @@ public:
/// \param mode checked to be DONT_SHARE for now
/// \param name checked to be dummy_app for now
/// \return The token and FD
+ /// \throw SocketAllocateError as described above, to test error handling
+ /// \throw ShareError as described above, to test error handling
/// \throw SocketError as described above, to test error handling
SocketID requestSocket(Protocol protocol, const std::string& address,
uint16_t port, ShareMode mode,
const std::string& name)
{
if (address == "192.0.2.2") {
- isc_throw(SocketError, "This address is not allowed");
+ isc_throw(SocketAllocateError, "This address is not allowed");
+ }
+ if (address == "192.0.2.3") {
+ isc_throw(SocketError, "Fatal test error");
}
if (address == "::1" && break_rollback_) {
// This is valid address, but in case we need to break the
@@ -145,7 +163,7 @@ public:
//
// We break the second address to see the first one was
// allocated and then returned
- isc_throw(SocketError,
+ isc_throw(ShareError,
"This address is available, but not for you");
}
const std::string proto(protocol == TCP ? "TCP" : "UDP");
More information about the bind10-changes
mailing list