BIND 10 #3164: MySQL connection timeout for invalid hosts is can be large

BIND 10 Development do-not-reply at isc.org
Wed Sep 11 19:39:21 UTC 2013


#3164: MySQL connection timeout for invalid hosts is can be large
-------------------------------------+-------------------------------------
                   Reporter:  tmark  |                 Owner:
                       Type:         |                Status:  new
  defect                             |             Milestone:  DHCP
                   Priority:  low    |  Outstanding Tasks
                  Component:         |              Keywords:
  dhcpdb                             |             Sensitive:  0
               CVSS Scoring:         |           Sub-Project:  DHCP
            Defect Severity:  N/A    |  Estimated Difficulty:  0
Feature Depending on Ticket:         |           Total Hours:  0
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
 Dhcpsrc unit test, MySqlOpenTest.OpenDatabase, was taking two minutes to
 complete on a fresh install of Fedora 19 with the community version of
 MySQL.  This exposes a minor issue with the connection timeout value not
 defaulting to reaonsably small values.  Since the server is presumed to be
 local to the DHCP servers, setting the connection timeout to a reasonable
 if not configurable value would be prudent.   The following patch would
 set the value at 5 seconds:

 {{{
 diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc
 b/src/lib/dhcpsrv/mysql_lease_mgr.cc
 index 9828085..12d5c39 100644
 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc
 +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc
 @@ -1106,6 +1106,13 @@ MySqlLeaseMgr::openDatabase() {
                    mysql_error(mysql_));
      }

 +    int connect_timeout = 5;
 +    result = mysql_options(mysql_, MYSQL_OPT_CONNECT_TIMEOUT,
 &connect_timeout);
 +    if (result != 0) {
 +        isc_throw(DbOpenError, "unable to set connect timeout option: "
 <<
 +                  mysql_error(mysql_));
 +    }
 +
      // Set SQL mode options for the connection:  SQL mode governs how
 what
      // constitutes insertable data for a given column, and how to handle
      // invalid data.  We want to ensure we get the strictest behavior and
 }}}

-- 
Ticket URL: <http://bind10.isc.org/ticket/3164>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list