ThreadSanitizer: lock-order-inversion (potential deadlock) - dns_resolver_createfetch vs. dns_resolver_prime
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=31641)
Cycle in lock order graph: M19990 (0x7b4c00010dc8) => M19989 (0x7b4c00010da0) => M19990
Mutex M19989 acquired here while holding mutex M19990 in thread T16:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 dns_resolver_createfetch /home/ondrej/Projects/bind9/lib/dns/resolver.c:10534 (libdns.so.1505+0x196d25)
#2 dns_resolver_prime /home/ondrej/Projects/bind9/lib/dns/resolver.c:10213 (libdns.so.1505+0x197af8)
#3 dns_view_find /home/ondrej/Projects/bind9/lib/dns/view.c:1113 (libdns.so.1505+0x1f7528)
#4 dbfind_name /home/ondrej/Projects/bind9/lib/dns/adb.c:3678 (libdns.so.1505+0x3f65f)
#5 dns_adb_createfind /home/ondrej/Projects/bind9/lib/dns/adb.c:3030 (libdns.so.1505+0x528d2)
#6 findname /home/ondrej/Projects/bind9/lib/dns/resolver.c:3382 (libdns.so.1505+0x186a47)
#7 fctx_getaddresses /home/ondrej/Projects/bind9/lib/dns/resolver.c:3669 (libdns.so.1505+0x19a933)
#8 fctx_try /home/ondrej/Projects/bind9/lib/dns/resolver.c:4029 (libdns.so.1505+0x1a1a94)
#9 fctx_start /home/ondrej/Projects/bind9/lib/dns/resolver.c:4651 (libdns.so.1505+0x1a5a0b)
#10 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56f36)
#11 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56f36)
#12 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M19990 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 dns_resolver_prime /home/ondrej/Projects/bind9/lib/dns/resolver.c:10212 (libdns.so.1505+0x197a82)
#2 dns_view_find /home/ondrej/Projects/bind9/lib/dns/view.c:1113 (libdns.so.1505+0x1f7528)
#3 dbfind_name /home/ondrej/Projects/bind9/lib/dns/adb.c:3678 (libdns.so.1505+0x3f65f)
#4 dns_adb_createfind /home/ondrej/Projects/bind9/lib/dns/adb.c:3030 (libdns.so.1505+0x528d2)
#5 findname /home/ondrej/Projects/bind9/lib/dns/resolver.c:3382 (libdns.so.1505+0x186a47)
#6 fctx_getaddresses /home/ondrej/Projects/bind9/lib/dns/resolver.c:3669 (libdns.so.1505+0x19a933)
#7 fctx_try /home/ondrej/Projects/bind9/lib/dns/resolver.c:4029 (libdns.so.1505+0x1a1a94)
#8 fctx_start /home/ondrej/Projects/bind9/lib/dns/resolver.c:4651 (libdns.so.1505+0x1a5a0b)
#9 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56f36)
#10 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56f36)
#11 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M19990 acquired here while holding mutex M19989 in thread T9:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 prime_done /home/ondrej/Projects/bind9/lib/dns/resolver.c:10149 (libdns.so.1505+0x1992cf)
#2 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56f36)
#3 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56f36)
#4 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M19989 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 prime_done /home/ondrej/Projects/bind9/lib/dns/resolver.c:10145 (libdns.so.1505+0x19927e)
#2 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56f36)
#3 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56f36)
#4 <null> <null> (libtsan.so.0+0x29b3d)
Thread T16 'isc-worker0007' (tid=31710, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bc54)
#2 isc_taskmgr_create /home/ondrej/Projects/bind9/lib/isc/task.c:1410 (libisc.so.1504+0x59cf3)
#3 create_managers main.c:902 (named+0x1aeec)
#4 setup main.c:1235 (named+0x1aeec)
#5 main main.c:1515 (named+0x1aeec)
Thread T9 'isc-worker0000' (tid=31703, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bc54)
#2 isc_taskmgr_create /home/ondrej/Projects/bind9/lib/isc/task.c:1410 (libisc.so.1504+0x59cf3)
#3 create_managers main.c:902 (named+0x1aeec)
#4 setup main.c:1235 (named+0x1aeec)
#5 main main.c:1515 (named+0x1aeec)
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/usr/lib/x86_64-linux-gnu/libtsan.so.0+0x3d62b) in pthread_mutex_lock