ASAN error in fctx_cancelquery()
Apparently #3018 (closed)/!5584 (merged) was not the only scenario to fix.
https://gitlab.isc.org/isc-projects/bind9/-/jobs/2233451
Click to expand/collapse backtrace
D:forward:Core was generated by `/builds/isc-projects/bind9/bin/named/.libs/named -D forward-ns3 -X named.lock -'. D:forward:Program terminated with signal SIGABRT, Aborted. D:forward:#0 0x00007f82ca52984c in __pthread_kill_implementation () from /lib64/libc.so.6 D:forward:[Current thread is 1 (Thread 0x7f82c26e8640 (LWP 6446))] D:forward:#0 0x00007f82ca52984c in __pthread_kill_implementation () from /lib64/libc.so.6 D:forward:#1 0x00007f82ca4dc6a6 in raise () from /lib64/libc.so.6 D:forward:#2 0x00007f82ca4c67d3 in abort () from /lib64/libc.so.6 D:forward:#3 0x00007f82ce2a05df in __sanitizer::Abort() () from /lib64/libasan.so.6 D:forward:#4 0x00007f82ce2ab94c in __sanitizer::Die() () from /lib64/libasan.so.6 D:forward:#5 0x00007f82ce28cd9c in __asan::ScopedInErrorReport::~ScopedInErrorReport() () from /lib64/libasan.so.6 D:forward:#6 0x00007f82ce28c666 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) () from /lib64/libasan.so.6 D:forward:#7 0x00007f82ce28d22c in __asan_report_load4 () from /lib64/libasan.so.6 D:forward:#8 0x00007f82cc974fa5 in fctx_cancelquery (queryp=queryp@entry=0x7f82c26e1fb0, finish=0x7f82c26e29a8, no_response=no_response@entry=false, age_untried=age_untried@entry=false) at resolver.c:1297 D:forward:#9 0x00007f82cc99e8df in rctx_done (rctx=rctx@entry=0x7f82c26e2930, result=result@entry=ISC_R_SUCCESS) at resolver.c:9658 D:forward:#10 0x00007f82cc9af918 in resquery_response (eresult=eresult@entry=ISC_R_SUCCESS, region=region@entry=0x7f82c26e4570, arg=) at resolver.c:7805 D:forward:#11 0x00007f82cc5b49a5 in udp_recv (handle=, eresult=ISC_R_SUCCESS, region=, arg=) at dispatch.c:593 D:forward:#12 0x00007f82cd8f6f00 in isc__nm_async_readcb (worker=worker@entry=0x0, ev0=ev0@entry=0x7f82c26e4610) at netmgr/netmgr.c:2798 D:forward:#13 0x00007f82cd8f755f in isc__nm_readcb (sock=sock@entry=0x61d0000a3280, uvreq=uvreq@entry=0x61d0000a4680, eresult=eresult@entry=ISC_R_SUCCESS) at netmgr/netmgr.c:2771 D:forward:#14 0x00007f82cd934490 in udp_recv_cb (handle=handle@entry=0x61d0000a3830, nrecv=nrecv@entry=339, buf=buf@entry=0x7f82c26e4860, addr=addr@entry=0x7f82c26e48b0, flags=flags@entry=0) at netmgr/udp.c:641 D:forward:#15 0x00007f82cd93854f in isc__nm_udp_read_cb (handle=0x61d0000a3830, nrecv=339, buf=0x7f82c26e4860, addr=0x7f82c26e48b0, flags=0) at netmgr/udp.c:1047 D:forward:#16 0x00007f82cb21acc4 in uv__udp_recvmsg (handle=0x61d0000a3830) at /usr/src/libuv-v1.43.0/src/unix/udp.c:302 D:forward:#17 0x00007f82cb21a5e8 in uv__udp_io (loop=0x6280000021e0, w=0x61d0000a38b0, revents=1) at /usr/src/libuv-v1.43.0/src/unix/udp.c:178 D:forward:#18 0x00007f82cb22162b in uv__io_poll (loop=0x6280000021e0, timeout=800) at /usr/src/libuv-v1.43.0/src/unix/epoll.c:374 D:forward:#19 0x00007f82cb205c01 in uv_run (loop=0x6280000021e0, mode=UV_RUN_DEFAULT) at /usr/src/libuv-v1.43.0/src/unix/core.c:389 D:forward:#20 0x00007f82cd8fad6d in nm_thread (worker0=0x6280000021d0) at netmgr/netmgr.c:691 D:forward:#21 0x00007f82cd9f87f6 in isc__trampoline_run (arg=0x60300002c6b0) at trampoline.c:187 D:forward:#22 0x00007f82ca527a87 in start_thread () from /lib64/libc.so.6 D:forward:#23 0x00007f82ca5ab8d4 in clone () from /lib64/libc.so.6 D:forward:--------------------------------------------------------------------------------
Unfortunately, the job ran over the weekend and the artifacts were no longer available when I tried to examine them today, so I am unable to paste the full ASAN report. However, judging from line numbers, the problem lies here:
1286 REQUIRE(queryp != NULL);
1287
1288 query = *queryp;
1289 fctx = query->fctx;
1290
1291 if (RESQUERY_CANCELED(query)) {
1292 return;
1293 }
1294
1295 FCTXTRACE("cancelquery");
1296
1297 >>> query->attributes |= RESQUERY_ATTR_CANCELED;
Looking at the test output, I sense this is happening on shutdown.