Mysql – bind9 dlz/thesql at ubuntu segfault libthesqlclient.so

binddomain-name-systemMySQLsegmentation-fault

I have a big problem.
I installed the bind9 nameserver to three different computer.
two Ubuntu 10.04.4 LTS, and one Ubuntu 11.10

I compiled it 9.7.0, 9.7.3, 9.9.0 with this method:

./configure --prefix=/usr --sysconfdir=/etc/bind --localstatedir=/var \
--mandir=/usr/share/man --infodir=/usr/share/info \
--enable-threads --enable-largefile --with-libtool --enable-shared --enable-static \
--with-openssl=/usr --with-gssapi=/usr --with-gnu-ld \
--with-dlz-mysql=yes --with-dlz-bdb=no \
--with-dlz-filesystem=yes --with-geoip=/usr

make

make install

After the set up for dlz/mysql, the BIND server is working perfetctly until 5-30 minute long. Ahter i got segfault.

I resolve temporaly the problem with a simple process watchdog, and if the named is stopped, the watchdog is restart it, but this is not a good idea in long therm.

My log output is:

messages:

Apr 13 19:33:51 dnsvm kernel: [    8.088696] eth0: link up
Apr 13 19:33:58 WATCHDOG: named not running. Restarting
Apr 13 19:35:08 dnsvm kernel: [   87.082572] named[1027]: segfault at 88 ip b71c4291 sp b5adfe30 error 4 in libmysqlclient.so.16.0.0[b714e000+1aa000]
Apr 13 19:35:08 WATCHDOG: named not running. Restarting
Apr 13 19:35:08 dnsvm kernel: [   87.457510] named[1423]: segfault at 68 ip b71d6122 sp b52f0a40 error 4 in libmysqlclient.so.16.0.0[b7160000+1aa000]
Apr 13 19:35:09 WATCHDOG: named not running. Restarting
Apr 13 19:41:56 dnsvm kernel: [  494.838206] named[1448]: segfault at 88 ip b731c291 sp b5436e30 error 4 in libmysqlclient.so.16.0.0[b72a6000+1aa000]
Apr 13 19:41:57 WATCHDOG: named not running. Restarting
Apr 13 19:57:26 dnsvm kernel: [ 1424.023409] named[2976]: segfault at 88 ip b72d1291 sp b6beee30 error 4 in libmysqlclient.so.16.0.0[b725b000+1aa000]
Apr 13 19:57:26 WATCHDOG: named not running. Restarting
Apr 13 20:11:56 dnsvm kernel: [ 2294.324663] named[6441]: segfault at 88 ip b7357291 sp b6473e30 error 4 in libmysqlclient.so.16.0.0[b72e1000+1aa000]
Apr 13 20:11:57 WATCHDOG: named not running. Restarting

syslog:
http://pastebin.com/hjUyt8gN

the first server is a native, normal x64 server (u1004lts), the second is virtualised server (u11.10) the third is also virtualised (10.04lts) This servers is only for dns providing with mysql server db. But the problem is be with all server, and all bind version.

named.conf:
http://pastebin.com/zwm1yP7V

Can anybody help me, or any good idea?

Best Answer

The problem: (from http://bind-dlz.sourceforge.net/mysql_driver.html)

The MySQL driver has one additional limitation. MySQL uses thread local storage in its C api. Thus MySQL requires that each thread of an application execute a MySQL "thread initialization" to setup the thread local storage. This is impossible to do safely while staying within the DLZ driver API. This is a limitation caused by MySQL, and not the DLZ API. Because of this BIND MUST only run with a single thread when using the MySQL driver. To ensure BIND runs with a single thread pass "-n 1" on the command line when starting BIND (named). This should not be a limitation on most UN*X systems as BIND is normally compiled single threaded (there are some exceptions). Even if BIND is compiled to support threads passing "-n 1" on the command line will cause it to use a single thread. Also, if the MySQL driver is compiled into BIND but NOT USED then "-n 1" is not required. The "-n 1" command line parameters are only required when the MySQL driver is USED.

RESOLVE:

nano /etc/defaults/bind9

and change this line:

# startup options for the server
OPTIONS="-u bind"

to:

# startup options for the server
OPTIONS="-u bind -n 1"

restart the DNS server.

Related Topic