Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 701710 - net-dns/bind - mysql dlz may crash with multiple bind processes
Summary: net-dns/bind - mysql dlz may crash with multiple bind processes
Status: RESOLVED DUPLICATE of bug 641694
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Christian Ruppert (idl0r)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-02 00:00 UTC by Marcel Greter
Modified: 2019-12-02 07:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Greter 2019-12-02 00:00:32 UTC
Hi,

I have a very old and trusty bind setup that used to work for some decades now. Lately I noticed that my external bind is constantly crashing. It uses a mysql db to store the dns entries. Beside creating a core dump in /var/bind, nothing is logged. It does not crash for simple queries, but I can reliably trigger it by using https://dnschecker.org/#A/.

So next I tried to run the daemon in the foreground with `named -f -c /etc/bind/named.conf`. This at least gave me some cryptic feedback:

unknown: debugger aborting because missing DBUG_RETURN or DBUG_VOID_RETURN macro in function "?func". Aborted (core dumped)

I was also able to get a useful stack trace with gdb at some point (with FEATURES="nostrip"), which clearly pointed in the direction of mysql dlz.

After a lot of unsuccessful tries to find any indication what could be the problem on the net, I finally came across https://serverfault.com/questions/379292/bind9-dlz-mysql-at-ubuntu-segfault-libmysqlclient-so:

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.

I opened this bug report in order to make this error message better searchable, but also to ask if it would be possible to either directly enable CPU="1" in /etc/conf.d/named if USE="dlz mysql" is detected and/or to at least add another comment to that option mentioning the above limitation.

Btw. I recently migrated the server from old hardware to a VM, which has 8 cores instead of 2. This probably explains why I didn't have the issue before.

Thank you and have a nice day!
Comment 1 Marcel Greter 2019-12-02 00:18:29 UTC
It seems maintainers are aware of this, as per top comment in the build file: https://github.com/gentoo/gentoo/blob/master/net-dns/bind/bind-9.15.6.ebuild.

IMO a warning during pkg_postinst would also work!
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2019-12-02 07:41:57 UTC

*** This bug has been marked as a duplicate of bug 641694 ***