BIND 10 #2916: define asiolink::IOSocketLocal

BIND 10 Development do-not-reply at isc.org
Thu May 16 13:08:16 UTC 2013


#2916: define asiolink::IOSocketLocal
-------------------------------------+-------------------------------------
            Reporter:  jinmei        |                        Owner:
                Type:  task          |  jinmei
            Priority:  medium        |                       Status:
           Component:  data source   |  reviewing
            Keywords:                |                    Milestone:
           Sensitive:  0             |  Sprint-20130528
         Sub-Project:  DNS           |                   Resolution:
Estimated Difficulty:  4             |                 CVSS Scoring:
         Total Hours:  0             |              Defect Severity:  N/A
                                     |  Feature Depending on Ticket:
                                     |  shared memory data source
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
Changes (by vorner):

 * owner:  vorner => jinmei


Comment:

 Hello

 Replying to [comment:10 jinmei]:
 > > What is the purpose here?
 > > {{{#!c++
 > >     aux_sockpair[0].set(socks[0]);
 > >     aux_sockpair[1].set(socks[1]);
 > >     LocalSocket aux_sock(io_service_, aux_sockpair[0].release());
 > > }}}
 > >
 > > If set never throws (it seemed to never throw), then there may be no
 exception between the set and release. If it can, then we can lose
 `socks[1]`.
 >
 > Ah, there's a slight bug here.  `LocalSocket` could throw (though we
 > don't expect it here), and in that case we'd lose socks[0] (I guess
 > you meant 0, not 1).  I've updated the code so it's more correct.

 I was wondering about the `aux_sockpair[0].set(socks[0]);` throwing (and
 then the [1] would not be set yet). But I think that one does not throw.

 But you are right about this one.

 Anyway, the tests fail for me now:
 {{{
 [ RUN      ] LocalSocketTest.constructError
 local_socket_unittest.cc:117: Failure
 Expected: LocalSocket(io_service_, fd) throws an exception of type
 IOError.
   Actual: it throws a different type.
 [  FAILED  ] LocalSocketTest.constructError (1 ms)
 }}}

 I went to get the exception (by removing the EXCEPT_THROW and running the
 tests with `--gtest_catch_exceptions=0`) and got this, I think it might
 help:
 {{{
 [ RUN      ] LocalSocketTest.constructError
 terminate called after throwing an instance of
 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<asio::system_error>
 >'
   what():  Invalid argument

 Program received signal SIGABRT, Aborted.
 0x00007ffff5c02545 in raise () from /lib64/libc.so.6
 (gdb) bt
 #0  0x00007ffff5c02545 in raise () from /lib64/libc.so.6
 #1  0x00007ffff5c039c8 in abort () from /lib64/libc.so.6
 #2  0x00007ffff64e699d in __gnu_cxx::__verbose_terminate_handler() ()
    from /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6
 #3  0x00007ffff64e4a76 in ?? () from /usr/lib/gcc/x86_64-pc-linux-
 gnu/4.7.3/libstdc++.so.6
 #4  0x00007ffff64e4aa3 in std::terminate() () from /usr/lib/gcc/x86_64-pc-
 linux-gnu/4.7.3/libstdc++.so.6
 #5  0x00007ffff64e4cce in __cxa_throw () from /usr/lib/gcc/x86_64-pc-
 linux-gnu/4.7.3/libstdc++.so.6
 #6  0x0000000000456f7e in boost::throw_exception<asio::system_error>
 (e=...)
     at /usr/include/boost/throw_exception.hpp:67
 #7  0x0000000000455ff1 in asio::detail::do_throw_error (err=...)
     at ../../../../ext/asio/asio/detail/impl/throw_error.ipp:32
 #8  0x0000000000455c19 in asio::detail::throw_error (err=...) at
 ../../../../ext/asio/asio/detail/throw_error.hpp:34
 #9  0x00007ffff7bc1e6c in asio::basic_socket<asio::local::stream_protocol,
 asio::stream_socket_service<asio::local::stream_protocol> >::basic_socket
 (this=0x6b1d70, io_service=..., protocol=...,
 native_socket=@0x7fffffffcefc: 8)
     at ../../../ext/asio/asio/basic_socket.hpp:132
 #10 0x00007ffff7bc1aa6 in
 asio::basic_stream_socket<asio::local::stream_protocol,
 asio::stream_socket_service<asio::local::stream_protocol>
 >::basic_stream_socket (this=0x6b1d70, io_service=..., protocol=...,
     native_socket=@0x7fffffffcefc: 8) at
 ../../../ext/asio/asio/basic_stream_socket.hpp:126
 #11 0x00007ffff7bc14de in isc::asiolink::LocalSocket::Impl::Impl
 (this=0x6b1d70, io_service=..., fd=8)
     at local_socket.cc:32
 #12 0x00007ffff7bbf943 in isc::asiolink::LocalSocket::LocalSocket
 (this=0x7fffffffd2e0, io_service=..., fd=8)
     at local_socket.cc:53
 #13 0x0000000000474988 in (anonymous
 namespace)::LocalSocketTest_constructError_Test::TestBody (this=0x6b2430)
     at local_socket_unittest.cc:117
 #14 0x00007ffff69dfe22 in void
 testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,
 void>(testing::Test*, void (testing::Test::*)(), char const*) () from
 /usr/lib/libgtest.so.0
 #15 0x00007ffff69d45d9 in testing::Test::Run() () from
 /usr/lib/libgtest.so.0
 #16 0x00007ffff69d46b7 in testing::TestInfo::Run() () from
 /usr/lib/libgtest.so.0
 #17 0x00007ffff69d47f5 in testing::TestCase::Run() () from
 /usr/lib/libgtest.so.0
 #18 0x00007ffff69d4b5d in testing::internal::UnitTestImpl::RunAllTests()
 () from /usr/lib/libgtest.so.0
 #19 0x00007ffff69df98f in bool
 testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,
 bool>(testing::internal::UnitTestImpl*, bool
 (testing::internal::UnitTestImpl::*)(), char const*) ()
    from /usr/lib/libgtest.so.0
 #20 0x00007ffff69d3e31 in testing::UnitTest::Run() () from
 /usr/lib/libgtest.so.0
 #21 0x0000000000479514 in isc::util::unittests::run_all () at
 run_all.cc:87
 #22 0x000000000042d760 in main (argc=1, argv=0x7fffffffd6a8) at
 run_unittests.cc:24
 }}}

-- 
Ticket URL: <http://bind10.isc.org/ticket/2916#comment:12>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list