Bug 247950 - dns/bind911 and dns/bind916: lmdb-0.9.24_2,1 causes problems with bind dynamic zones after reload
Summary: dns/bind911 and dns/bind916: lmdb-0.9.24_2,1 causes problems with bind dynami...
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Mathieu Arnold
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-13 14:10 UTC by david
Modified: 2020-07-20 13:50 UTC (History)
2 users (show)

See Also:


Attachments
dns/bind916: Apply upstream change of LMDB locking. (7.73 KB, patch)
2020-07-15 05:52 UTC, Xin LI
delphij: maintainer-approval? (mat)
Details | Diff
dns/bind911: Apply upstream change of LMDB locking (8.01 KB, patch)
2020-07-15 06:20 UTC, Xin LI
delphij: maintainer-approval? (mat)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description david 2020-07-13 14:10:30 UTC
Since lmdb-0.9.24_2,1 bind with dynamic zones has problems after HUP. This happens in our setup every night when newsyslog runs. It seems the fix in #244493 may have issues.

Steps to reproduce:
* Install bind (bind911 and bind916 both tested)
* Add "allow-new-zones yes;" under options section of /usr/local/etc/namedb/named.conf
* service named restart
* kill -HUP `cat /var/run/named/pid`
* rndc -k /usr/local/etc/namedb/rndc.key addzone 'example.org {type slave; masters { 127.0.0.1;}; file "/usr/local/etc/namedb/slave/example.org";};'
* Check /var/log/messages, find errors like:
  Jul 13 14:05:57 davidtest named[74867]: mdb_txn_begin: Invalid argument
  Jul 13 14:05:57 davidtest named[74867]: mdb_txn_begin: Invalid argument

We've downgraded to lmdb-0.9.24_1,1 which does not have this problem.
Comment 1 Xin LI freebsd_committer 2020-07-15 05:51:11 UTC
(In reply to david from comment #0)
Thanks for the report.  I have looked at ISC repository and found that it's actually an known upstream issue:

https://gitlab.isc.org/isc-projects/bind9/-/issues/1976

It seems that there were some architectural difference that would make it hard to fix it in BIND itself, so the upstream decided to solve it (for now) with doing the locking in BIND itself instead of relying on LMDB.

I'll post a patch to fix this for BIND 9.16 which worked for me for mat@'s approval.
Comment 2 Xin LI freebsd_committer 2020-07-15 05:52:26 UTC
Created attachment 216456 [details]
dns/bind916: Apply upstream change of LMDB locking.

Full background at https://gitlab.isc.org/isc-projects/bind9/-/issues/1976
Comment 3 Xin LI freebsd_committer 2020-07-15 06:20:45 UTC
Created attachment 216457 [details]
dns/bind911: Apply upstream change of LMDB locking
Comment 4 Xin LI freebsd_committer 2020-07-15 06:21:27 UTC
Over to maintainer.
Comment 5 Mathieu Arnold freebsd_committer 2020-07-17 16:57:51 UTC
I will have a look next week.
Comment 6 Xin LI freebsd_committer 2020-07-17 17:40:56 UTC
(In reply to Mathieu Arnold from comment #5)
Thanks!  Note that this would be part of next release of BIND, so if you are updating them soon, please feel free to just use the next release and disregard this patchset.
Comment 7 Mathieu Arnold freebsd_committer 2020-07-20 13:49:50 UTC
Mmmm, does it need to be merged to the current quartely branch? I have a hard time figuring out if it is needed or not.
Comment 8 commit-hook freebsd_committer 2020-07-20 13:50:22 UTC
A commit references this bug:

Author: mat
Date: Mon Jul 20 13:50:14 UTC 2020
New revision: 542640
URL: https://svnweb.freebsd.org/changeset/ports/542640

Log:
  Fix rndc with LMDB 0.9.26+.

  PR:		247950
  Submitted by: 	delphij
  Reportedy:	david isnic is
  Obtained from:	https://gitlab.isc.org/isc-projects/bind9/-/issues/1976
  MFH:		2020Q3 (not sure if needed)

Changes:
  head/dns/bind911/Makefile
  head/dns/bind911/files/extrapatch-bind-lmdb-lock
  head/dns/bind916/Makefile
  head/dns/bind916/files/extrapatch-bind-lmdb-lock