Changeset 2109

Show
Ignore:
Timestamp:
03/31/11 09:51:27 (2 years ago)
Author:
ahu
Message:

fix crashes reported by Vasiliy G Tolstov and Frank Altpeter - turns out we were handing a copy of the database connection to the master/slave connection.. while we were still using it!

Location:
trunk/pdns/pdns
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/dnsbackend.hh

    r2058 r2109  
    4444struct DomainInfo 
    4545{ 
     46  DomainInfo() : backend(0) {} 
    4647  uint32_t id; 
    4748  string zone; 
  • trunk/pdns/pdns/slavecommunicator.cc

    r2107 r2109  
    7272  L<<Logger::Error<<"Initiating transfer of '"<<domain<<"' from remote '"<<remote<<"'"<<endl; 
    7373  uint32_t domain_id; 
    74   PacketHandler P; 
     74  PacketHandler P; // fresh UeberBackend 
    7575 
    7676  DomainInfo di; 
     
    7878  bool first=true;     
    7979  try { 
    80     UeberBackend *B=dynamic_cast<UeberBackend *>(P.getBackend()); 
     80    UeberBackend *B=dynamic_cast<UeberBackend *>(P.getBackend());  // copy of the same UeberBackend 
    8181    NSEC3PARAMRecordContent ns3pr; 
    8282    bool narrow; 
    83     DNSSECKeeper dk; 
     83    DNSSECKeeper dk; // has its own ueberbackend 
    8484    bool dnssecZone = false; 
    8585    bool haveNSEC3=false; 
     
    9898                }     
    9999 
    100     if(!B->getDomainInfo(domain, di) || !di.backend) { 
     100    if(!B->getDomainInfo(domain, di) || !di.backend) { // di.backend and B are mostly identical 
    101101      L<<Logger::Error<<"Can't determine backend for domain '"<<domain<<"'"<<endl; 
    102102      return; 
     
    288288{ 
    289289  Lock l(&d_lock); 
    290   d_tocheck.insert(di); 
     290  DomainInfo ours = di; 
     291  ours.backend = 0; 
     292  d_tocheck.insert(ours); 
    291293  d_any_sem.post(); // kick the loop! 
    292294} 
     
    365367  BOOST_FOREACH(val_t& val, sdomains) { 
    366368    DomainInfo& di(val.first); 
     369    if(!di.backend) // might've come from the packethandler 
     370      B->getDomainInfo(di.zone, di); 
    367371    if(!ssr.d_freshness.count(di.id))  
    368372      continue;