Bug 296904 - devel/json-c: 0.19 triggers out of memory in bind920
Summary: devel/json-c: 0.19 triggers out of memory in bind920
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-07-19 13:09 UTC by Gert Doering
Modified: 2026-08-05 21:48 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
memory graph (290.60 KB, image/png)
2026-07-19 20:22 UTC, Gert Doering
no flags Details
git format-patch for the current port (2.39 KB, patch)
2026-08-05 21:48 UTC, Dan Mahoney
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gert Doering 2026-07-19 13:09:28 UTC
Hi,

we recently upgraded our authoritative nameservers to "most recent pkg tree", and subsequently one of the bind instances started crashing with "out of memory" errors, about 1-2x per day

  kernel: pid 12492 (named), jid 0, uid 53, was killed: failed to reclaim memory

Normally, bind uses under 500M SIZE on this machine with this set of zones and typical query traffic.  The machine has 8G RAM, and I could observe (in top) named going well beyond 3.5G SIZE - and then eventually crashing.

The update entailed bind918 -> bind920, lmdb -> lmdb-0.95, and more, so I initially blamed "bind 9.20" and tried downgrading to 9.18, which didn't help.  Tried named config flags (max-cache and all that), which didn't help.

Since this did not help, I looked at "what other parts of the system were upgraded at the same time" - and the only dependency of bind920 upgraded at the same time (besides FreeBSD system libraries) was json-c (from 0.18 to 0.19).  So I tried force-downgrading json-c to 0.18, and the named crashes are gone again - after 2 days, named is at a stable 431M ("back to normal").

The system in question is:

FreeBSD ns4-base 14.4-RELEASE-p7 FreeBSD 14.4-RELEASE-p7 #0 -dirty: Tue Jun 30 08:53:56 UTC 2026     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

bind920-9.20.24_1
lmdb0-0.9.35
json-c-0.18

... not sure how to debug this further.  It seems to be related to query volume (two other bind instances have seen "memory growth" and "OOM crash", but far slower grown / more infrequent crashes).

Tried googling, couldn't find anything that sounded related - so reporting it here, in case someone else runs into this.
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2026-07-19 15:45:49 UTC
It's not related to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296786 ?
Comment 2 Gert Doering 2026-07-19 20:08:12 UTC
I looked at all the libraries, and between "it has no issues", "it crashes 2x per day" and "it has no issues again" liburcu was not changed

lrwxr-xr-x  1 root wheel    16 Dec 20  2025 liburcu.so -> liburcu.so.8.1.0
lrwxr-xr-x  1 root wheel    16 Dec 20  2025 liburcu.so.8 -> liburcu.so.8.1.0
-rwxr-xr-x  1 root wheel 36880 Dec 20  2025 liburcu.so.8.1.0

gert@ns4-base-c$ pkg info liburcu
liburcu-0.15.3
Name           : liburcu
Version        : 0.15.3
Installed on   : Sat Jan  3 13:51:23 2026 CET
Origin         : sysutils/liburcu
Architecture   : FreeBSD:14:amd64

- it might be that the liburcu issue is triggering something in the newer libjson-c - but with the older json-c pkg, the mem leak is definitely gone again.

So maybe it's the same issue, maybe not, but it definitely only manifested after my July 11 upgrade.

Happy to re-test & report back when the new liburcu version shows up.
Comment 3 Gert Doering 2026-07-19 20:22:01 UTC
Created attachment 273008 [details]
memory graph

memory statistics from prometheus

07/13 18:00 Ugrade bind 9.18 + json-c 0.18 -> bind 9.20 + json-c 0.19 
07/14 02:44 named crash
07/14 06:67 downgrade bind to 9.18 (+lmdb-0.9.35) 
07/14 15:50 named crash 
07/16 08:30 upgrade to bind 9.20 again (+lmdb0-0.9.35)
07/17 20:10 downgrade json-c to 0.18 (keep bind at 9.20)
Comment 4 Ray Bellis 2026-07-31 20:13:56 UTC
This is a json-c bug, fixed in https://github.com/json-c/json-c/pull/936

It could really do with an urgent back port.
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2026-08-01 09:49:04 UTC
I have a patched version in my ports-overlay repo if you want to give that a spin.
https://github.com/diizzyy/ports-overlay/tree/main/devel/json-c
https://github.com/diizzyy/ports-overlay/
Comment 6 Dan Mahoney 2026-08-05 21:48:58 UTC
Created attachment 273495 [details]
git format-patch for the current port

Attached is a git format-patch against current version that applies the commits above and bumps PORTREVISION, which should suffice until an 0.20 drops.  Would request this be MFC'd to quarterly if possible.