BIND 10 master, updated. 58da05cd5f8709c8f4e1824c5479a0e3cd2b4371 Merge branch 'master' of git+ssh://bind10.isc.org/var/bind10/git/bind10

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Mar 9 10:12:51 UTC 2011


The branch, master has been updated
       via  58da05cd5f8709c8f4e1824c5479a0e3cd2b4371 (commit)
       via  a447b8e583551311e487816e11a171fdb0e8951a (commit)
       via  e0863720a874d75923ea66adcfbf5b2948efb10a (commit)
       via  9287cc8f31d6ed03cdcd95f6ca59b58ed6d695b6 (commit)
       via  34eaa7c5e831bb170f0fe8792e40df88f66ed8b9 (commit)
       via  b9d341ecd382b44d72888899e3559d7d41baa203 (commit)
       via  b2d210a1ed486dc8c1083deb6f1b0bf2802e8d57 (commit)
       via  3407184a20c367a0de02b41befb4db16971c9589 (commit)
      from  416fcf7eb6c7c0dc249bcc838d75504f070750a1 (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 58da05cd5f8709c8f4e1824c5479a0e3cd2b4371
Merge: a447b8e583551311e487816e11a171fdb0e8951a 416fcf7eb6c7c0dc249bcc838d75504f070750a1
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Mar 9 09:43:50 2011 +0100

    Merge branch 'master' of git+ssh://bind10.isc.org/var/bind10/git/bind10

commit a447b8e583551311e487816e11a171fdb0e8951a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Mar 8 23:51:08 2011 +0100

    Changelog for #657

commit e0863720a874d75923ea66adcfbf5b2948efb10a
Merge: 241571157deb66f6766918b783379409e294e2f5 9287cc8f31d6ed03cdcd95f6ca59b58ed6d695b6
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Mar 8 23:41:01 2011 +0100

    Merge branch 'work/busyloop'

commit 9287cc8f31d6ed03cdcd95f6ca59b58ed6d695b6
Merge: 34eaa7c5e831bb170f0fe8792e40df88f66ed8b9 b9d341ecd382b44d72888899e3559d7d41baa203
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Mar 8 21:19:41 2011 +0100

    Merge remote-tracking branch 'origin/trac657' into work/busyloop

commit 34eaa7c5e831bb170f0fe8792e40df88f66ed8b9
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Mar 8 21:17:34 2011 +0100

    [trac657] Use OS-independent error messages
    
    The asio wraps them, so we can be portable.

commit b9d341ecd382b44d72888899e3559d7d41baa203
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Mar 4 15:35:59 2011 -0800

    [trac657] Revert "[trac657] Remove nop operation"
    
    This reverts commit 3407184a20c367a0de02b41befb4db16971c9589.
    
    This is not nop, and is necessary for the default sqlite3 data source
    in the "from source" mode.

commit b2d210a1ed486dc8c1083deb6f1b0bf2802e8d57
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Mar 4 17:28:56 2011 +0100

    [trac657] Abort on fatal errors
    
    Like when the socket is closed. Trying to accept more connections on
    such socket lead to busy loop.

commit 3407184a20c367a0de02b41befb4db16971c9589
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Mar 4 16:39:10 2011 +0100

    [trac657] Remove nop operation
    
    Not directly related to the ticket, I just discovered a call that does
    nothing (it is called with null pointer and the function checks the
    parameter is not null, if it is, it just does nothing).

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                      |    7 +++++++
 src/lib/asiolink/tcp_server.cc |   15 +++++++++++++--
 src/lib/asiolink/udp_server.cc |    9 +++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index ffa794b..791575e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+  194.  [bug]       vorner
+	Solved a 100% CPU usage problem after switching addresses in b10-auth
+	(and possibly, but unconfirmed, in b10-resolver). It was caused by
+	repeated reads/accepts on closed socket (the bug was in the code for a
+	long time, recent changes made it show).
+	(Trac #657, git e0863720a874d75923ea66adcfbf5b2948efb10a)
+
   193.	[func]*		jreed
 	Listen on the IPv6 (::) and IPv4 (0.0.0.0) wildcard addresses
 	for b10-auth. This returns to previous behavior prior to
diff --git a/src/lib/asiolink/tcp_server.cc b/src/lib/asiolink/tcp_server.cc
index df19b00..3e0cdb4 100644
--- a/src/lib/asiolink/tcp_server.cc
+++ b/src/lib/asiolink/tcp_server.cc
@@ -17,6 +17,7 @@
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <unistd.h>             // for some IPC/network system calls
+#include <errno.h>
 
 #include <boost/shared_array.hpp>
 
@@ -83,11 +84,21 @@ TCPServer::operator()(error_code ec, size_t length) {
             /// Create a socket to listen for connections
             socket_.reset(new tcp::socket(acceptor_->get_io_service()));
 
-            /// Wait for new connections. In the event of error,
+            /// Wait for new connections. In the event of non-fatal error,
             /// try again
             do {
                 CORO_YIELD acceptor_->async_accept(*socket_, *this);
-            } while (!ec);
+                // Abort on fatal errors
+                // TODO: Log error?
+                if (ec) {
+                    using namespace asio::error;
+                    if (ec.value() != would_block && ec.value() != try_again &&
+                        ec.value() != connection_aborted &&
+                        ec.value() != interrupted) {
+                        return;
+                    }
+                }
+            } while (ec);
 
             /// Fork the coroutine by creating a copy of this one and
             /// scheduling it on the ASIO service queue.  The parent
diff --git a/src/lib/asiolink/udp_server.cc b/src/lib/asiolink/udp_server.cc
index 98a47c4..2c19608 100644
--- a/src/lib/asiolink/udp_server.cc
+++ b/src/lib/asiolink/udp_server.cc
@@ -15,6 +15,7 @@
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <unistd.h>             // for some IPC/network system calls
+#include <errno.h>
 
 #include <boost/shared_array.hpp>
 
@@ -195,6 +196,14 @@ UDPServer::operator()(error_code ec, size_t length) {
                 CORO_YIELD data_->socket_->async_receive_from(
                     buffer(data_->data_.get(), MAX_LENGTH), *data_->sender_,
                     *this);
+                // Abort on fatal errors
+                if (ec) {
+                    using namespace asio::error;
+                    if (ec.value() != would_block && ec.value() != try_again &&
+                        ec.value() != interrupted) {
+                        return;
+                    }
+                }
             } while (ec || length == 0);
 
             data_->bytes_ = length;




More information about the bind10-changes mailing list