From c0063e602fda2d8eaeef83002e1d04e3aa0655e8 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Thu, 26 Nov 2015 15:26:39 +0100 Subject: [PATCH] improve filedescriptor requesting code so it requests more filedescriptors, plus actually uses the number of launched threads in the calculation... Potentially relevant for 3.7.3 as well! --- pdns/pdns_recursor.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 4538e398d0..275ab6bf08 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1975,17 +1975,19 @@ static void checkLinuxIPv6Limits() } static void checkOrFixFDS() { - unsigned int availFDs=getFilenumLimit()-10; // some healthy margin, thanks AJ ;-) - if(g_maxMThreads * g_numWorkerThreads > availFDs) { - if(getFilenumLimit(true) >= g_maxMThreads * g_numWorkerThreads) { - setFilenumLimit(g_maxMThreads * g_numWorkerThreads); - L< availFDs) { + if(getFilenumLimit(true) >= wantFDs) { + setFilenumLimit(wantFDs); + L< 1 ? forks : -1); g_numThreads = ::arg().asNum("threads") + ::arg().mustDo("pdns-distributes-queries"); + g_numWorkerThreads = ::arg().asNum("threads"); g_maxMThreads = ::arg().asNum("max-mthreads"); checkOrFixFDS(); - - int newgid=0; if(!::arg()["setgid"].empty()) newgid=Utility::makeGidNumeric(::arg()["setgid"]); @@ -2281,8 +2282,7 @@ int serviceMain(int argc, char*argv[]) } Utility::dropUserPrivs(newuid); - g_numThreads = ::arg().asNum("threads") + ::arg().mustDo("pdns-distributes-queries"); - g_numWorkerThreads = ::arg().asNum("threads"); + makeThreadPipes(); g_tcpTimeout=::arg().asNum("client-tcp-timeout"); -- 2.47.2