]> granicus.if.org Git - pdns/commitdiff
fix startup race condition with carbon thread already trying to broadcast uninitializ...
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 11 Dec 2014 12:57:35 +0000 (13:57 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 11 Dec 2014 12:57:35 +0000 (13:57 +0100)
pdns/common_startup.cc

index 3e81ba46c5f7e553076948bcab48fb9c8344b131..f4635c3e863fdc56a24bc665c8b43cb7a3e55344 100644 (file)
@@ -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 {