ThreadSanitizer: lock-order-inversion (potential deadlock) - isc__nm_enqueue_ievent vs isc_nm_listentcp
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=18511)
Cycle in lock order graph: M596862637233476224 (0x000000000000) => M1105 (0x7fbaf719dcd0) => M596862637233476224
Mutex M1105 acquired here while holding mutex M596862637233476224 in thread T9:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 isc__nm_enqueue_ievent /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:601 (libisc.so.1504+0x3f20c)
#2 isc_nm_listentcp /home/ondrej/Projects/bind9/lib/isc/netmgr/tcp.c:190 (libisc.so.1504+0x452ab)
#3 isc_nm_listentcpdns /home/ondrej/Projects/bind9/lib/isc/netmgr/tcpdns.c:299 (libisc.so.1504+0x4899f)
#4 ns_interface_listentcp /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:463 (libns.so.1502+0x1b0d3)
#5 ns_interface_setup /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:516 (libns.so.1502+0x1b0d3)
#6 do_scan /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:1070 (libns.so.1502+0x1c023)
#7 ns_interfacemgr_scan0 /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:1130 (libns.so.1502+0x1c8fd)
#8 ns_interfacemgr_scan /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:1177 (libns.so.1502+0x1ca72)
#9 load_configuration server.c:8712 (named+0x53e83)
#10 run_server server.c:9654 (named+0x59a47)
#11 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56f36)
#12 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56f36)
#13 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M596862637233476224 previously acquired by the same thread here:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 isc_nm_listentcp /home/ondrej/Projects/bind9/lib/isc/netmgr/tcp.c:189 (libisc.so.1504+0x4526b)
#2 isc_nm_listentcpdns /home/ondrej/Projects/bind9/lib/isc/netmgr/tcpdns.c:299 (libisc.so.1504+0x4899f)
#3 ns_interface_listentcp /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:463 (libns.so.1502+0x1b0d3)
#4 ns_interface_setup /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:516 (libns.so.1502+0x1b0d3)
#5 do_scan /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:1070 (libns.so.1502+0x1c023)
#6 ns_interfacemgr_scan0 /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:1130 (libns.so.1502+0x1c8fd)
#7 ns_interfacemgr_scan /home/ondrej/Projects/bind9/lib/ns/interfacemgr.c:1177 (libns.so.1502+0x1ca72)
#8 load_configuration server.c:8712 (named+0x53e83)
#9 run_server server.c:9654 (named+0x59a47)
#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 M596862637233476224 acquired here while holding mutex M1105 in thread T3:
#0 pthread_mutex_lock <null> (libtsan.so.0+0x3d62b)
#1 isc__nm_async_tcplisten /home/ondrej/Projects/bind9/lib/isc/netmgr/tcp.c:338 (libisc.so.1504+0x44e9b)
#2 process_queue /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:538 (libisc.so.1504+0x41fd5)
#3 nm_thread /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:438 (libisc.so.1504+0x422b1)
#4 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M1105 previously acquired by the same thread here:
#0 pthread_cond_wait <null> (libtsan.so.0+0x48e9e)
#1 nm_thread /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:435 (libisc.so.1504+0x4228e)
#2 <null> <null> (libtsan.so.0+0x29b3d)
Thread T9 'isc-worker0000' (tid=18534, 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 T3 'isc-net-0002' (tid=18528, 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_nm_start /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:149 (libisc.so.1504+0x3ec4a)
#3 create_managers main.c:895 (named+0x1ae90)
#4 setup main.c:1235 (named+0x1ae90)
#5 main main.c:1515 (named+0x1ae90)
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/usr/lib/x86_64-linux-gnu/libtsan.so.0+0x3d62b) in pthread_mutex_lock