ThreadSanitizer: lock-order-inversion (potential deadlock) - validator_start vs. dns_resolver_createfetch
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=21211)
Cycle in lock order graph: M100197 (0x7b7000010008) => M1110 (0x7b7400000008) => M100197
Mutex M1110 acquired here while holding mutex M100197 in thread T1:
#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 create_fetch /home/ondrej/Projects/bind9/lib/dns/validator.c:1055 (libdns.so.1505+0x1f1c55)
#3 seek_dnskey /home/ondrej/Projects/bind9/lib/dns/validator.c:1305 (libdns.so.1505+0x1f1c55)
#4 validate_answer /home/ondrej/Projects/bind9/lib/dns/validator.c:1557 (libdns.so.1505+0x1f1c55)
#5 validator_start /home/ondrej/Projects/bind9/lib/dns/validator.c:3157 (libdns.so.1505+0x1f2ac9)
#6 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56f36)
#7 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56f36)
#8 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M100197 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 validator_start /home/ondrej/Projects/bind9/lib/dns/validator.c:3140 (libdns.so.1505+0x1f27a8)
#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 M100197 acquired here while holding mutex M1110 in thread T1:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 dns_validator_destroy /home/ondrej/Projects/bind9/lib/dns/validator.c:3402 (libdns.so.1505+0x1f23da)
#2 validated /home/ondrej/Projects/bind9/lib/dns/resolver.c:5379 (libdns.so.1505+0x1a8153)
#3 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56f36)
#4 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56f36)
#5 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M1110 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 validated /home/ondrej/Projects/bind9/lib/dns/resolver.c:5365 (libdns.so.1505+0x1a7f4e)
#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 T1 'isc-worker0000' (tid=21226, 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 isc_taskmgr_createinctx /home/ondrej/Projects/bind9/lib/isc/task.c:1978 (libisc.so.1504+0x5f3a2)
#4 main /home/ondrej/Projects/bind9/bin/delv/delv.c:1730 (delv+0x3cfa)
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/usr/lib/x86_64-linux-gnu/libtsan.so.0+0x3d62b) in pthread_mutex_lock