From: bert hubert Date: Thu, 11 Dec 2014 12:57:35 +0000 (+0100) Subject: fix startup race condition with carbon thread already trying to broadcast uninitializ... X-Git-Tag: rec-3.7.0-rc1~118 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba98c6d7633284b5a4b48f77b59591fbb9f9af05;p=thirdparty%2Fpdns.git fix startup race condition with carbon thread already trying to broadcast uninitialized data --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index 3e81ba46c5..f4635c3e86 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -191,7 +191,10 @@ try { int totcount=0; BOOST_FOREACH(DNSDistributor* d, g_distributors) { + if(!d) + continue; int qcount, acount; + d->getQueueSizes(qcount, acount); // this does locking and other things, so don't get smart totcount+=qcount; } @@ -466,14 +469,14 @@ void mainthread() if(TN) TN->go(); // tcp nameserver launch - pthread_create(&qtid,0,carbonDumpThread, 0); // runs even w/o carbon, might change @ runtime - // fork(); (this worked :-)) unsigned int max_rthreads= ::arg().asNum("receiver-threads", 1); g_distributors.resize(max_rthreads); for(unsigned int n=0; n < max_rthreads; ++n) pthread_create(&qtid,0,qthread, reinterpret_cast(n)); // receives packets + pthread_create(&qtid,0,carbonDumpThread, 0); // runs even w/o carbon, might change @ runtime + for(;;) { sleep(1800); try {