DoH: dig eventually aborts on ALPN negotiation failure when issuing a DoH query (because of dangling handles)
It was found by accident that dig
crashes when issuing a query against a server which does not support HTTP/2, or to be more precise, when 'h2' ALPN token negotiation fails.
;; Connection to 127.0.0.1#44344(127.0.0.1) for example failed: ALPN for HTTP/2 failed.
;; Connection to 127.0.0.1#44344(127.0.0.1) for example failed: ALPN for HTTP/2 failed.
;; Connection to 127.0.0.1#44344(127.0.0.1) for example failed: ALPN for HTTP/2 failed.
Outstanding sockets
=================
Active server socket 0x7f172da91a00, type isc_nm_tlssocket, refs 1
Parent (nil), listener (nil), server (nil), statichandle = (nil)
Flags: closing
Created by:
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc___nmsocket_init+0x276)[0x7f1732594301]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_nm_tlsconnect+0xb9)[0x7f17325fbfdb]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_nm_httpconnect+0x89f)[0x7f17325f1ce2]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x18fb5)[0x560157b26fb5]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x1e20d)[0x560157b2c20d]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x14874)[0x560157b22874]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x1e2a6)[0x560157b2c2a6]
=================
Active server socket 0x7f172da93800, type isc_nm_tlssocket, refs 1
Parent (nil), listener (nil), server (nil), statichandle = (nil)
Flags: closing
Created by:
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc___nmsocket_init+0x276)[0x7f1732594301]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_nm_tlsconnect+0xb9)[0x7f17325fbfdb]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_nm_httpconnect+0x89f)[0x7f17325f1ce2]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x18fb5)[0x560157b26fb5]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x1e20d)[0x560157b2c20d]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x14874)[0x560157b22874]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x13dfd)[0x560157b21dfd]
=================
Active server socket 0x7f172da91000, type isc_nm_tlssocket, refs 1
Parent (nil), listener (nil), server (nil), statichandle = (nil)
Flags: closing
Created by:
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc___nmsocket_init+0x276)[0x7f1732594301]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_nm_tlsconnect+0xb9)[0x7f17325fbfdb]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_nm_httpconnect+0x89f)[0x7f17325f1ce2]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x18fb5)[0x560157b26fb5]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x1e20d)[0x560157b2c20d]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x14874)[0x560157b22874]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x13dfd)[0x560157b21dfd]
netmgr/netmgr.c:578: INSIST(0) failed, back trace
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(+0x42894)[0x7f17325b2894]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_assertion_failed+0x31)[0x7f17325b27a7]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc__netmgr_destroy+0x10d)[0x7f173258f0d8]
/home/artem/projects/isc/open/bind9/lib/isc/.libs/libisc-9.17.20.so(isc_managers_destroy+0xf5)[0x7f17325ca823]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x1e815)[0x560157b2c815]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0xef35)[0x560157b1cf35]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0xef96)[0x560157b1cf96]
/usr/lib/libc.so.6(__libc_start_main+0xd5)[0x7f1731645b25]
/home/artem/projects/isc/open/bind9/bin/dig/.libs/lt-dig(+0x5e9e)[0x560157b13e9e]
Aborted (core dumped)
Edited by Artem Boldariev