[Pdns-dev] virtual memory issue and gmysql

Patrick Domack patrickdk at patrickdk.com
Mon Oct 1 04:30:24 CEST 2007


I have seen reports of this in the users maillist.

the rpm package for pdns-static version 2.9.21
on redhat el5 x86_64

I did attempt a recompile from source, and it slowed down how much  
memory it ate, but didn't stop it. Using pmap it just keeps chewing up  
10240K blocks.

I patched up smysql.cc and I haven't seen it chew up memory yet (only  
running for 1 hour, but normally it should be up to 2gigs by now, and  
it is still hasn't allocated anymore than what it started out with).  
This also fixes the no responce cause mysql connection died issue.  
(well, it corrects the mysql issue, but just doesn't cause whatever  
happens that causes the memory issue, the users list seems to think  
it's something to do with threaded, or the guardian, but my tests show  
the guardian has no effect if it's on or off)


Quoting bert hubert <bert.hubert at netherlabs.nl>:

> On Sun, Sep 30, 2007 at 09:12:51PM -0400, Patrick Domack wrote:
>> I have noticed since I installed the static rpm an never ending
>> increase of virtual memory allocation. I have noticed like others, if
>> mysql drops the connection cause of idle timeout, pdns doesn't
>> reconnect and errors out the dns request. It seems like each time it
>> does this, it uses more memory.
>
> Which version? Other users do not report or see this problem. Where did you
> get your version (binary package?).
>
> 	Bert
>
> --
> http://www.PowerDNS.com      Open source, database driven DNS Software
> http://netherlabs.nl              Open and Closed source services
>


-------------- next part --------------
--- modules/gmysqlbackend/smysql.cc.orig	2007-10-01 03:14:24.000000000 -0400
+++ modules/gmysqlbackend/smysql.cc	2007-10-01 03:14:51.000000000 -0400
@@ -14,7 +14,12 @@
 SMySQL::SMySQL(const string &database, const string &host, uint16_t port, const string &msocket, const string &user, 
 	       const string &password)
 {
+  unsigned long version;
+  my_bool my_true=true;
+  
+  version=mysql_get_client_version();
   mysql_init(&d_db);
+  mysql_options(&d_db, MYSQL_OPT_RECONNECT, &my_true);
   if (!mysql_real_connect(&d_db, host.empty() ? 0 : host.c_str(), 
 			  user.empty() ? 0 : user.c_str(), 
 			  password.empty() ? 0 : password.c_str(),
@@ -24,7 +29,9 @@
 
     throw sPerrorException("Unable to connect to database");
   }
-
+  if (version < 50020) {
+    mysql_options(&d_db, MYSQL_OPT_RECONNECT, &my_true);
+  }  
   d_rres=0;
 }
 


More information about the Pdns-dev mailing list