From: Evan Hunt Date: Fri, 22 Feb 2019 22:53:30 +0000 (-0800) Subject: restore allowance for tcp-clients < interfaces X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8413996db53465953966e72ca51129faa9a0bb9b;p=thirdparty%2Fbind9.git restore allowance for tcp-clients < interfaces in the "refactor tcpquota and pipeline refs" commit, the counting of active interfaces was tightened in such a way that named could fail to listen on an interface if there were more interfaces than tcp-clients. when checking the quota to start accepting on an interface, if the number of active clients was above zero, then it was presumed that some other client was able to handle accepting new connections. this, however, ignored the fact that the current client could be included in that count, so if the quota was already exceeded before all the interfaces were listening, some interfaces would never listen. we now check whether the current client has been marked active; if so, then the number of active clients on the interface must be greater than 1, not 0. (cherry picked from commit 71fead4c3e03b178d6e6e3ff7592b45cf5f94069) (cherry picked from commit 785658728ad29ef497fb6770d0688d07f55ab5c5) --- diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index fc5d5c63f85..49d8f998a6f 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -8424,7 +8424,8 @@ avoid-v6-udp-ports { 40000; range 50000 60000; }; The number of file descriptors reserved for TCP, stdio, etc. This needs to be big enough to cover the number of - interfaces named listens on, tcp-clients as well as + interfaces named listens on plus + tcp-clients, as well as to provide room for outgoing TCP queries and incoming zone transfers. The default is 512. The minimum value is 128 and the diff --git a/lib/ns/client.c b/lib/ns/client.c index 665dcaf507c..d8ab3ce9c69 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -3441,8 +3441,9 @@ client_accept(ns_client_t *client) { * * So, we check here to see if any other clients are * already servicing TCP queries on this interface (whether - * accepting, reading, or processing). If we find at least - * one, then it's okay *not* to call accept - we can let this + * accepting, reading, or processing). If we find that at + * least one client other than this one is active, then + * it's okay *not* to call accept - we can let this * client go inactive and another will take over when it's * done. * @@ -3456,7 +3457,8 @@ client_accept(ns_client_t *client) { * quota is tcp-clients plus the number of listening * interfaces plus 1.) */ - exit = (isc_atomic_xadd(&client->interface->ntcpactive, 0) > 0); + exit = (isc_atomic_xadd(&client->interface->ntcpactive, 0) > + (client->tcpactive ? 1 : 0)); if (exit) { client->newstate = NS_CLIENTSTATE_INACTIVE; (void)exit_check(client);