From: bert hubert Date: Thu, 26 Nov 2015 14:26:39 +0000 (+0100) Subject: improve filedescriptor requesting code so it requests more filedescriptors, plus... X-Git-Tag: dnsdist-1.0.0-alpha1~190^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0063e602fda2d8eaeef83002e1d04e3aa0655e8;p=pdns 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! --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 4538e398d..275ab6bf0 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");