Hi Andreas, I'll also provide feedback to you here. We very much appreciate bug reports like this, where the submitter puts an effort to diagnose, describe and (possibly) fix the issue. Thank you for that. Unfortunately, this particular issue has been already fixed in the current stable release (9.20) and the previous stable 9.18 is in the "deep freeze" mode where we only fix critical or security bugs (or do DNS protocol maintenance if needed).
I certainly don't want to discourage you from any future work as I like how you approach things, but we can't merge this patch in the BIND 9.18 release branch. Thank you, Ondrej -- Ondřej Surý (He/Him) ond...@isc.org My working hours and your working hours may be different. Please do not feel obligated to reply outside your normal working hours. > On 10. 7. 2025, at 10:13, Andreas Kempe <andreas.ke...@actia.se> wrote: > > Hello everyone, > > We discovered an issue in the error handling branch of > dns_cache_create(). The cleanup branch of this function directly calls > cache_free() which asserts because neither cache->references, nor > cache->live_tasks is zero. > > This is an example backtrace: > named[22736]: cache.c:265: REQUIRE(isc_refcount_current(&cache->references) > == 0) failed, back trace > named[22736]: /opt/bind/lib/libisc-9.18.37.so(isc_backtrace+0x1b) > [0x7f83bba3fa9b] > named[22736]: ./named(+0x73321) [0x5644ce0c8321] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(isc_assertion_failed+0x10) > [0x7f83bba3f220] > named[22736]: /opt/bind/lib/libdns-9.18.37.so(+0xfafb5) [0x7f83bb45bfb5] > named[22736]: /opt/bind/lib/libdns-9.18.37.so(dns_cache_create+0x40c) > [0x7f83bb45d42c] > named[22736]: ./named(+0xa8b86) [0x5644ce0fdb86] > named[22736]: ./named(+0xd50af) [0x5644ce12a0af] > named[22736]: ./named(+0xd750b) [0x5644ce12c50b] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(isc_task_run+0x40b) > [0x7f83bba8a24b] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(+0x587bc) [0x7f83bb9ff7bc] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(+0x6a719) [0x7f83bba11719] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(+0x6b675) [0x7f83bba12675] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(+0x6c8fb) [0x7f83bba138fb] > named[22736]: /usr/lib64/libuv.so.1(+0x122b3) [0x7f83ba7cf2b3] > named[22736]: /usr/lib64/libuv.so.1(+0x26d57) [0x7f83ba7e3d57] > named[22736]: /usr/lib64/libuv.so.1(uv_run+0xc6) [0x7f83ba7d0146] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(+0x6bb84) [0x7f83bba12b84] > named[22736]: /opt/bind/lib/libisc-9.18.37.so(isc__trampoline_run+0x44) > [0x7f83bba9d584] > named[22736]: /usr/lib/gcc/x86_64-pc-linux-gnu/14/libasan.so.8(+0x5b3aa) > [0x7f83bbb9b3aa] > named[22736]: /usr/lib64/libc.so.6(+0x91873) [0x7f83ba4b2873] > named[22736]: /usr/lib64/libc.so.6(+0x11090c) [0x7f83ba53190c] > > This issue was discovered in an automated test case that managed to > send a SIGTERM to named shortly after startup when it was still > initialising, causing functions in dns_cache_create() to return > ISC_R_SHUTTINGDOWN. > > I believe the issue was introduced in commit > 26ad166a05a5f791fc66b4f5039a31bc59d0d6ab when this function was > reworked. > > I wrote a small patch, although I am no expert in the bind code base, > that seemingly fixes the issue for us by using dns_cache_detach(), see > attachment. I have tested the patch on 9.18.37 by placing > kill(getpid(), SIGTERM) in various locations in the function to > provoke the issue. > > Hope this can be helpful for anyone else encountering this issue! > > Best regards, > Andreas Kempe > <0001-lib-dns-cache-fix-cleanup-in-dns_cache_create.patch>-- > Visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from > this list > > ISC funds the development of this software with paid support subscriptions. > Contact us at https://www.isc.org/contact/ for more information. > > > bind-users mailing list > bind-users@lists.isc.org > https://lists.isc.org/mailman/listinfo/bind-users -- Visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information. bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users