[Pdns-dev] gmysql hangs if mysql server stops responding

John Leach john at brightbox.co.uk
Tue Apr 26 13:37:12 CEST 2011


Hi,

If the mysql server stops responding (anything short of sending a tcp
reset), the gmysql backend hangs until the tcp connection times out
(many minutes by default).

Attached is a patch to set the mysql library read and write timeouts so
that if the mysql server stops responding, pdns learns about it quickly.
Coupled with the MYSQL_OPT_RECONNECT added in pdns 3, it just reconnects
automatically.

This patch sets the timeout at 10 seconds and the mysql library will
retry 3 times by default, so it should be 30 seconds max before a
reconnect.

pdns 3 does now read the mysql config file, but I can't find any way to
set these particular options using it - I'm pretty certain they need to
be set like this, in the code.

We've used pdns in conjunction with both mysql-proxy and haproxy for
high availability and it's basically useless without this patch, as they
both depend on the client timing out and reconnecting when a backend
server goes down.

John.
--
http://beta.brightbox.com




-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmysqlbackend-timeout-pdns-3.0-rc2.patch
Type: text/x-patch
Size: 696 bytes
Desc: not available
URL: <http://mailman.powerdns.com/pipermail/pdns-dev/attachments/20110426/451a89e0/attachment.bin>


More information about the Pdns-dev mailing list