ThreadSanitizer: lock-order-inversion (potential deadlock) - dns_resolver_createfetch vs dns_resolver_shutdown
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=25300)
Cycle in lock order graph: M1131 (0x7b7400000238) => M1728 (0x7b4c000001d0) => M1131
Mutex M1728 acquired here while holding mutex M1131 in thread T1:
#0 pthread_mutex_lock <null> (delv+0x4492a6)
#1 fcount_incr /home/ondrej/Projects/bind9/lib/dns/resolver.c:1524:2 (libdns.so.1505+0x15b6ab)
#2 fctx_create /home/ondrej/Projects/bind9/lib/dns/resolver.c:4928:11 (libdns.so.1505+0x156959)
#3 dns_resolver_createfetch /home/ondrej/Projects/bind9/lib/dns/resolver.c:10588:12 (libdns.so.1505+0x15435e)
#4 create_fetch /home/ondrej/Projects/bind9/lib/dns/validator.c:1055:10 (libdns.so.1505+0x1a239a)
#5 seek_dnskey /home/ondrej/Projects/bind9/lib/dns/validator.c:1305:12 (libdns.so.1505+0x1a2f84)
#6 validate_answer /home/ondrej/Projects/bind9/lib/dns/validator.c:1557:13 (libdns.so.1505+0x1a06b3)
#7 validator_start /home/ondrej/Projects/bind9/lib/dns/validator.c:3157:13 (libdns.so.1505+0x19f013)
#8 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134:7 (libisc.so.1504+0x52007)
#9 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319:2 (libisc.so.1504+0x4f3a8)
Mutex M1131 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (delv+0x4492a6)
#1 dns_resolver_createfetch /home/ondrej/Projects/bind9/lib/dns/resolver.c:10545:2 (libdns.so.1505+0x1540f4)
#2 create_fetch /home/ondrej/Projects/bind9/lib/dns/validator.c:1055:10 (libdns.so.1505+0x1a239a)
#3 seek_dnskey /home/ondrej/Projects/bind9/lib/dns/validator.c:1305:12 (libdns.so.1505+0x1a2f84)
#4 validate_answer /home/ondrej/Projects/bind9/lib/dns/validator.c:1557:13 (libdns.so.1505+0x1a06b3)
#5 validator_start /home/ondrej/Projects/bind9/lib/dns/validator.c:3157:13 (libdns.so.1505+0x19f013)
#6 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134:7 (libisc.so.1504+0x52007)
#7 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319:2 (libisc.so.1504+0x4f3a8)
Mutex M1131 acquired here while holding mutex M1728 in main thread:
#0 pthread_mutex_lock <null> (delv+0x4492a6)
#1 dns_resolver_shutdown /home/ondrej/Projects/bind9/lib/dns/resolver.c:10312:4 (libdns.so.1505+0x155107)
#2 view_flushanddetach /home/ondrej/Projects/bind9/lib/dns/view.c:582:4 (libdns.so.1505+0x1a7031)
#3 dns_view_detach /home/ondrej/Projects/bind9/lib/dns/view.c:635:2 (libdns.so.1505+0x1a72eb)
#4 destroyclient /home/ondrej/Projects/bind9/lib/dns/client.c:611:3 (libdns.so.1505+0x213882)
#5 dns_client_destroy /home/ondrej/Projects/bind9/lib/dns/client.c:652:3 (libdns.so.1505+0x21369b)
#6 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1827:3 (delv+0x4b9926)
Mutex M1728 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (delv+0x4492a6)
#1 dns_resolver_shutdown /home/ondrej/Projects/bind9/lib/dns/resolver.c:10307:2 (libdns.so.1505+0x155004)
#2 view_flushanddetach /home/ondrej/Projects/bind9/lib/dns/view.c:582:4 (libdns.so.1505+0x1a7031)
#3 dns_view_detach /home/ondrej/Projects/bind9/lib/dns/view.c:635:2 (libdns.so.1505+0x1a72eb)
#4 destroyclient /home/ondrej/Projects/bind9/lib/dns/client.c:611:3 (libdns.so.1505+0x213882)
#5 dns_client_destroy /home/ondrej/Projects/bind9/lib/dns/client.c:652:3 (libdns.so.1505+0x21369b)
#6 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1827:3 (delv+0x4b9926)
Thread T1 'isc-worker0000' (tid=25315, running) created by main thread at:
#0 pthread_create <null> (delv+0x42b04b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75:8 (libisc.so.1504+0x6a9ea)
#2 isc_taskmgr_create /home/ondrej/Projects/bind9/lib/isc/task.c:1410:3 (libisc.so.1504+0x4f1b2)
#3 isc_taskmgr_createinctx /home/ondrej/Projects/bind9/lib/isc/task.c:1978:11 (libisc.so.1504+0x51a92)
#4 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1730:2 (delv+0x4b93d9)
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/home/ondrej/Projects/bind9/bin/delv/.libs/delv+0x4492a6) in pthread_mutex_lock