BIND 10 trac2916, updated. 7185b57ec3dfe44fb5ed0188e6234725cfb8fff0 [2916] corrected handling of aux socket wrt exception safety
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed May 15 18:32:44 UTC 2013
The branch, trac2916 has been updated
via 7185b57ec3dfe44fb5ed0188e6234725cfb8fff0 (commit)
via 1910b46df9c17fd817dd38ccf6748cdc49c6e821 (commit)
via da5d0b9b61f06c13ecfad23fd0dd4b4fc0734c77 (commit)
via 3f5fb3767356584c73a7de584adbc4da6159683a (commit)
from c832257c559d982c221595331f75e16df2e0b5f5 (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 7185b57ec3dfe44fb5ed0188e6234725cfb8fff0
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 15 11:31:57 2013 -0700
[2916] corrected handling of aux socket wrt exception safety
commit 1910b46df9c17fd817dd38ccf6748cdc49c6e821
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 15 11:27:21 2013 -0700
[2916] clarified what would happen if write blocks, and then return from test.
it should be safe to continue as clarified in the comment, but it's probably
better to eliminate any possibility of hangup.
commit da5d0b9b61f06c13ecfad23fd0dd4b4fc0734c77
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 15 11:22:18 2013 -0700
[2916] reset global IOService to NULL at end of test for safer operation
commit 3f5fb3767356584c73a7de584adbc4da6159683a
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed May 15 11:16:33 2013 -0700
[2916] clear alarm in the test's destructor.
-----------------------------------------------------------------------
Summary of changes:
src/lib/asiolink/tests/local_socket_unittest.cc | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/asiolink/tests/local_socket_unittest.cc b/src/lib/asiolink/tests/local_socket_unittest.cc
index 2b90877..b851ca3 100644
--- a/src/lib/asiolink/tests/local_socket_unittest.cc
+++ b/src/lib/asiolink/tests/local_socket_unittest.cc
@@ -75,6 +75,11 @@ protected:
}
~LocalSocketTest() {
+ alarm(0);
+ // reset the global to NULL to detect any invalid access to freed
+ // io_service (this shouldn't happen, so we don't change stopIOService
+ // itself)
+ g_io_service_ = NULL;
std::signal(SIGALRM, prev_handler_);
}
@@ -149,7 +154,13 @@ LocalSocketTest::checkAsyncRead(size_t data_len) {
expected_data[i] = i & 0xff;
}
alarm(IO_TIMEOUT);
- EXPECT_EQ(data_len, write(sock_pair_[1].get(), &expected_data[0],
+ // If write blocks, it will eventually fail due to signal interruption.
+ // Since io_service has been stopped already, run() would immediately
+ // return and test should complete (with failure). But to make very sure
+ // it never cause hangup we rather return from the test at the point of
+ // failure of write. In either case it signals a failure and need for
+ // a fix.
+ ASSERT_EQ(data_len, write(sock_pair_[1].get(), &expected_data[0],
data_len));
io_service_.run();
EXPECT_TRUE(callback_called);
@@ -189,7 +200,8 @@ TEST_F(LocalSocketTest, asyncPartialRead) {
ScopedSocket aux_sockpair[2];
aux_sockpair[0].set(socks[0]);
aux_sockpair[1].set(socks[1]);
- LocalSocket aux_sock(io_service_, aux_sockpair[0].release());
+ LocalSocket aux_sock(io_service_, aux_sockpair[0].get());
+ aux_sockpair[0].release(); // on successful construction we should release
bool aux_callback_called = false;
aux_sock.asyncRead(boost::bind(&callback, _1, &io_service_,
&aux_callback_called, false), &ch, 1);
More information about the bind10-changes
mailing list