dig in 9.19.13 crashes, when cancelling (with CTRL+C) a pending query to to a not reachable TCP port
Summary
dig
in 9.19.13 crashes, when cancelling a pending TCP query to a not reachable port. It doesn't matter, if I use IPv4 or IPv6.
BIND version used
$ dig -v
DiG 9.19.13
Steps to reproduce
Query the server:
$ dig -6 @ns.isc.afilias-nst.info. -p 333 isc.org +norec +tcp
Press "CTRL+C"
^C
Error:
;; Connection to 2001:500:2c::254#333(2001:500:2c::254) for isc.org failed: shutting down.
signal.c:78: REQUIRE(((signal) != ((void *)0) && ((const isc__magic_t *)(signal))->magic == ((('S') << 24 | ('I') << 16 | ('G') << 8 | (' '))))) failed, back trace
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x30bf3)[0x7f23e92abbf3]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_assertion_failed+0x10)[0x7f23e92abb30]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_signal_stop+0x41)[0x7f23e92ca4a1]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_loopmgr_blocking+0x1e)[0x7f23e92c05fe]
/home/thomy/bin/bind/bin/dig(get_address+0x36)[0x55a9f426e496]
/home/thomy/bin/bind/bin/dig(+0x1511e)[0x55a9f427011e]
/home/thomy/bin/bind/bin/dig(+0x1607f)[0x55a9f427107f]
/home/thomy/bin/bind/bin/dig(+0x1847e)[0x55a9f427347e]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x234fd)[0x7f23e929e4fd]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x238c3)[0x7f23e929e8c3]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x21a16)[0x7f23e929ca16]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc__nm_failed_connect_cb+0xbe)[0x7f23e929d25e]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x27892)[0x7f23e92a2892]
/lib/x86_64-linux-gnu/libuv.so.1(uv__stream_destroy+0x54)[0x7f23e8dd2a14]
/lib/x86_64-linux-gnu/libuv.so.1(uv_run+0x188)[0x7f23e8dc78b8]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x438c4)[0x7f23e92be8c4]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x5263d)[0x7f23e92cd63d]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_loopmgr_run+0x12c)[0x7f23e92bfbfc]
/home/thomy/bin/bind/bin/dig(main+0x2b)[0x55a9f4262d6b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f23e8e19083]
/home/thomy/bin/bind/bin/dig(_start+0x2e)[0x55a9f4262dae]
Aborted (core dumped)
A full dig
-debug looks like this:
$ dig -d -6 @ns.isc.afilias-nst.info. -p 333 isc.org +norec +tcp
setup_libs()
setup_system()
create_search_list()
ndots is 1.
timeout is 0.
retries is 3.
get_server_list()
make_server(::1)
dig_query_setup
parse_args()
making new lookup
make_empty_lookup()
make_empty_lookup() = 0x55a79bff7fa0->references = 1
digrc (open)
main parsing -d
main parsing -6
main parsing @ns.isc.afilias-nst.info.
make_server(2001:500:2c::254)
main parsing -p
main parsing isc.org
clone_lookup()
make_empty_lookup()
make_empty_lookup() = 0x55a79bffaca0->references = 1
clone_server_list()
make_server(2001:500:2c::254)
looking up isc.org
main parsing +norec
main parsing +tcp
dig_startup()
start_lookup()
setup_lookup(0x55a79bffaca0)
resetting lookup counter.
idn_textname: isc.org
using root origin
AD query
add_question()
starting to render the message
add_opt()
done rendering
create query 0x55a79bfe3540 linked to lookup 0x55a79bffaca0
dighost.c:2151:lookup_attach(0x55a79bffaca0) = 2
dighost.c:2661:new_query(0x55a79bfe3540) = 1
do_lookup()
start_tcp(0x55a79bfe3540)
dighost.c:2938:query_attach(0x55a79bfe3540) = 2
query->servname = 2001:500:2c::254
dighost.c:3026:query_attach(0x55a79bfe3540) = 3
^Ctcp_connected()
tcp_connected(0x55a79c031a90, shutting down, 0x55a79bfe3540)
dighost.c:3536:lookup_attach(0x55a79bffaca0) = 3
unsuccessful connection: shutting down
;; Connection to 2001:500:2c::254#333(2001:500:2c::254) for isc.org failed: shutting down.
making new TCP request, 2 tries left
requeue_lookup()
clone_lookup()
make_empty_lookup()
make_empty_lookup() = 0x55a79c031c40->references = 1
clone_server_list()
make_server(2001:500:2c::254)
before insertion, init@0x55a79bffaca0 -> 0xffffffffffffffff, new@0x55a79c031c40 -> 0xffffffffffffffff
after insertion, init -> 0x55a79bffaca0, new = 0x55a79c031c40, new -> (nil)
dighost.c:1739:query_detach(0x55a79bfe3540) = 2
dighost.c:3604:query_detach(0x55a79bfe3540) = 1
dighost.c:3606:_cancel_lookup()
canceling pending query 0x55a79bfe3540, belonging to 0x55a79bffaca0
dighost.c:2784:query_detach(0x55a79bfe3540) = 0
dighost.c:2784:destroy_query(0x55a79bfe3540) = 0
dighost.c:1697:lookup_detach(0x55a79bffaca0) = 2
check_if_done()
list full
pending lookup 0x55a79c031c40
dighost.c:3608:lookup_detach(0x55a79bffaca0) = 1
clear_current_lookup()
lookup cleared
dighost.c:1830:lookup_detach(0x55a79bffaca0) = 0
destroy_lookup
freeing server 0x55a79bffc2e0 belonging to 0x55a79bffaca0
start_lookup()
setup_lookup(0x55a79c031c40)
idn_textname: isc.org
using root origin
AD query
add_question()
starting to render the message
add_opt()
done rendering
create query 0x55a79bfe3540 linked to lookup 0x55a79c031c40
dighost.c:2151:lookup_attach(0x55a79c031c40) = 2
dighost.c:2661:new_query(0x55a79bfe3540) = 1
do_lookup()
start_tcp(0x55a79bfe3540)
dighost.c:2938:query_attach(0x55a79bfe3540) = 2
query->servname = 2001:500:2c::254
signal.c:78: REQUIRE(((signal) != ((void *)0) && ((const isc__magic_t *)(signal))->magic == ((('S') << 24 | ('I') << 16 | ('G') << 8 | (' '))))) failed, back trace
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x30bf3)[0x7f2d0f2afbf3]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_assertion_failed+0x10)[0x7f2d0f2afb30]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_signal_stop+0x41)[0x7f2d0f2ce4a1]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_loopmgr_blocking+0x1e)[0x7f2d0f2c45fe]
/home/thomy/bin/bind/bin/dig(get_address+0x36)[0x55a79a1a1496]
/home/thomy/bin/bind/bin/dig(+0x1511e)[0x55a79a1a311e]
/home/thomy/bin/bind/bin/dig(+0x1607f)[0x55a79a1a407f]
/home/thomy/bin/bind/bin/dig(+0x1847e)[0x55a79a1a647e]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x234fd)[0x7f2d0f2a24fd]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x238c3)[0x7f2d0f2a28c3]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x21a16)[0x7f2d0f2a0a16]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc__nm_failed_connect_cb+0xbe)[0x7f2d0f2a125e]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x27892)[0x7f2d0f2a6892]
/lib/x86_64-linux-gnu/libuv.so.1(uv__stream_destroy+0x54)[0x7f2d0edd6a14]
/lib/x86_64-linux-gnu/libuv.so.1(uv_run+0x188)[0x7f2d0edcb8b8]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x438c4)[0x7f2d0f2c28c4]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(+0x5263d)[0x7f2d0f2d163d]
/home/thomy/bin/bind-9.19.13/lib/libisc-9.19.13.so(isc_loopmgr_run+0x12c)[0x7f2d0f2c3bfc]
/home/thomy/bin/bind/bin/dig(main+0x2b)[0x55a79a195d6b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f2d0ee1d083]
/home/thomy/bin/bind/bin/dig(_start+0x2e)[0x55a79a195dae]
Aborted (core dumped)
What is the current bug behavior?
See above.
What is the expected correct behavior?
I assume, that dig
shouldn't crash, when cancelling a TCP query to a not responsive port.