Permalink
Browse files

fix startup race condition with carbon thread already trying to broad…

…cast uninitialized data
  • Loading branch information...
1 parent 02653a7 commit 63c8088966f03a34ab8ebeb6f1e7104a6ec793fc @ahupowerdns ahupowerdns committed with mind04 Dec 11, 2014
Showing with 5 additions and 2 deletions.
  1. +5 −2 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<void *>(n)); // receives packets
+ pthread_create(&qtid,0,carbonDumpThread, 0); // runs even w/o carbon, might change @ runtime
+
for(;;) {
sleep(1800);
try {

0 comments on commit 63c8088

Please sign in to comment.