[Pdns-dev] OpendbxBackend cumulative masters bug?

David Coles lists at potentialdeathtrap.net
Fri Mar 25 17:42:22 CET 2011


Hello.

My colleague recently posted a query ("Multiple Masters causing strange 
issue") to pdns-users regarding some strange behaviour that we are 
seeing with pdns-2.9.22. We have a lot of slaved domains. For each 
slaved domain we are seeing attempts to transfer the domain from a long 
list of masters whch are not (all) configured for those domains.

As far as I can tell this is because the "DomainInfo di;" declaration is 
outside of the "do" loop which is executed for each zone and the 
di.masters list is never cleared, so domains successively get a longer 
and longer cumulative list of masters for the previous zones.

I've included a patch below which should demonstrate this. With the 
"di.masters.clear();" statement left in, for a particular domain I see 
the following in the logs:

Mar 25 16:07:34 v1 pdns[30457]: [OpendbxBackend] MASTER example.com: 
192.168.128.106

However with "di.masters.clear();" commented out the following is observed:

Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.131.96
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.127
...
Mar 25 16:05:14 v1 pdns[30500]: [OpendbxBackend] MASTER example.com: 
192.168.128.106

With "..." representing a hundred or so lines!

I think the answer is either to use a clear() on the list in each 
iteration of the do loop or to declare DomainInfo di;" inside the do 
loop so that it does not retain information from previous iterations.

This is literally the first time I have looked at the code for PowerDNS 
and what little C++ I have is very rusty so I do apologise if I have 
made any unwarranted assumptions or have misinterpreted the way that the 
code should work!

Cheers,

David


*** odbxprivate.cc.orig    Fri Mar 25 16:11:52 2011
--- odbxprivate.cc    Fri Mar 25 16:12:33 2011
***************
*** 207,213 ****
--- 207,217 ----
          {
              if( ( tmp = odbx_field_value( m_result, 2 ) ) != NULL )
              {
+                 di.masters.clear();
                  stringtok(di.masters, string( tmp, odbx_field_length( 
m_result, 2 )), ", \t" );
+                 if( ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )
+                           for(vector<string>::const_iterator iter = 
di.masters.begin(); iter != di.masters.end(); ++iter)
+                             L.log( m_myname + " MASTER "+tmp+": 
"+*iter,  Logger::Warning );
              }
 
              if( ( tmp = odbx_field_value( m_result, 1 ) ) != NULL )


More information about the Pdns-dev mailing list