ThreadSanitizer: lock-order-inversion (potential deadlock) - fcount_incr vs. dns_resolver_createfetch
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=21211)
Cycle in lock order graph: M1110 (0x7b7400000008) => M1728 (0x7b4c000001d0) => M1110
Mutex M1728 acquired here while holding mutex M1110 in main thread:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 fcount_incr /home/ondrej/Projects/bind9/lib/dns/resolver.c:1525 (libdns.so.1505+0x185598)
#2 fctx_create /home/ondrej/Projects/bind9/lib/dns/resolver.c:4925 (libdns.so.1505+0x190783)
#3 dns_resolver_createfetch /home/ondrej/Projects/bind9/lib/dns/resolver.c:10581 (libdns.so.1505+0x1976b1)
#4 start_fetch /home/ondrej/Projects/bind9/lib/dns/client.c:777 (libdns.so.1505+0x27d26a)
#5 client_resfind /home/ondrej/Projects/bind9/lib/dns/client.c:862 (libdns.so.1505+0x27d26a)
#6 dns_client_startresolve /home/ondrej/Projects/bind9/lib/dns/client.c:1388 (libdns.so.1505+0x281c0c)
#7 dns_client_resolve /home/ondrej/Projects/bind9/lib/dns/client.c:1249 (libdns.so.1505+0x283501)
#8 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1788 (delv+0x5d92)
Mutex M1110 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 dns_resolver_createfetch /home/ondrej/Projects/bind9/lib/dns/resolver.c:10538 (libdns.so.1505+0x196da5)
#2 start_fetch /home/ondrej/Projects/bind9/lib/dns/client.c:777 (libdns.so.1505+0x27d26a)
#3 client_resfind /home/ondrej/Projects/bind9/lib/dns/client.c:862 (libdns.so.1505+0x27d26a)
#4 dns_client_startresolve /home/ondrej/Projects/bind9/lib/dns/client.c:1388 (libdns.so.1505+0x281c0c)
#5 dns_client_resolve /home/ondrej/Projects/bind9/lib/dns/client.c:1249 (libdns.so.1505+0x283501)
#6 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1788 (delv+0x5d92)
Mutex M1110 acquired here while holding mutex M1728 in main thread:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 dns_resolver_shutdown /home/ondrej/Projects/bind9/lib/dns/resolver.c:10305 (libdns.so.1505+0x196844)
#2 view_flushanddetach /home/ondrej/Projects/bind9/lib/dns/view.c:582 (libdns.so.1505+0x1fc44d)
#3 dns_view_detach /home/ondrej/Projects/bind9/lib/dns/view.c:635 (libdns.so.1505+0x1fc53e)
#4 destroyclient /home/ondrej/Projects/bind9/lib/dns/client.c:611 (libdns.so.1505+0x2810ec)
#5 dns_client_destroy /home/ondrej/Projects/bind9/lib/dns/client.c:652 (libdns.so.1505+0x2810ec)
#6 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1827 (delv+0x3bf2)
Mutex M1728 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 dns_resolver_shutdown /home/ondrej/Projects/bind9/lib/dns/resolver.c:10300 (libdns.so.1505+0x196777)
#2 view_flushanddetach /home/ondrej/Projects/bind9/lib/dns/view.c:582 (libdns.so.1505+0x1fc44d)
#3 dns_view_detach /home/ondrej/Projects/bind9/lib/dns/view.c:635 (libdns.so.1505+0x1fc53e)
#4 destroyclient /home/ondrej/Projects/bind9/lib/dns/client.c:611 (libdns.so.1505+0x2810ec)
#5 dns_client_destroy /home/ondrej/Projects/bind9/lib/dns/client.c:652 (libdns.so.1505+0x2810ec)
#6 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1827 (delv+0x3bf2)
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/usr/lib/x86_64-linux-gnu/libtsan.so.0+0x3d62b) in pthread_mutex_lock