Assertion failure in dig with "+tcp" option and multiple servers when there is a connection error
Assertion failure in dig with "+tcp" option and multiple servers when there is a connection error
The following command, assuming dig
can not connect to 10.53.0.99
, will produce an assertion failure in current main
and v9_18
:
dig +tcp @10.53.0.99 @10.53.0.98 a.example
;; Connection to 10.53.0.99#53(10.53.0.99) for a.example failed: connection refused.
;; Connection to 10.53.0.99#53(10.53.0.99) for a.example failed: connection refused.
;; Connection to 10.53.0.99#53(10.53.0.99) for a.example failed: connection refused.
dighost.c:2705: REQUIRE((((query)) != ((void *)0) && ((const isc__magic_t *)((query)))->magic == ((('D') << 24 | ('i') << 16 | ('g') << 8 | ('q'))))) failed, back trace
lib/isc/.libs/libisc-9.17.22.so(+0x367df)[0x7f7862fd87df]
lib/isc/.libs/libisc-9.17.22.so(isc_assertion_failed+0xa)[0x7f7862fd873a]
bin/dig/.libs/lt-dig(+0x135b2)[0x561295c345b2]
bin/dig/.libs/lt-dig(+0x140fd)[0x561295c350fd]
lib/isc/.libs/libisc-9.17.22.so(isc__nm_async_connectcb+0xa5)[0x7f7862fc4fe5]
lib/isc/.libs/libisc-9.17.22.so(isc__nm_connectcb+0xa4)[0x7f7862fc5134]
lib/isc/.libs/libisc-9.17.22.so(isc__nm_failed_connect_cb+0xb8)[0x7f7862fc7778]
lib/isc/.libs/libisc-9.17.22.so(+0x29c63)[0x7f7862fcbc63]
/usr/lib/libuv.so.1(+0x20069)[0x7f7862b17069]
/usr/lib/libuv.so.1(+0x24d0e)[0x7f7862b1bd0e]
/usr/lib/libuv.so.1(uv_run+0x678)[0x7f7862b05438]
lib/isc/.libs/libisc-9.17.22.so(+0x24f0a)[0x7f7862fc6f0a]
lib/isc/.libs/libisc-9.17.22.so(isc__trampoline_run+0x16)[0x7f78630018f6]
/usr/lib/libc.so.6(+0x8d5c2)[0x7f78621965c2]
/usr/lib/libc.so.6(clone+0x44)[0x7f786221b584]
Aborted (core dumped)
The reason is that in dighost.c:tcp_connected()
, after the first server fails to connect +tries
times (3 by default), dig
cancels the whole lookup before starting a query with the next server in the lookup.