lock-order-inversion (potential deadlock) - nm_thread vs nm_destroy
Unit tests are generating.
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
Cycle in lock order graph: M1 (0x000000000001) => M2 (0x000000000002) => M1
Mutex M2 acquired here while holding mutex M1 in thread T1:
#0 pthread_mutex_lock <null>
#1 nm_thread lib/isc/netmgr/netmgr.c:426:4
Mutex M1 previously acquired by the same thread here:
#0 pthread_mutex_lock <null>
#1 nm_thread lib/isc/netmgr/netmgr.c:424:3
Mutex M1 acquired here while holding mutex M2 in main thread:
#0 pthread_mutex_lock <null>
#1 nm_destroy lib/isc/netmgr/netmgr.c:177:3
#2 isc_nm_detach lib/isc/netmgr/netmgr.c:308:3
#3 cleanup_managers lib/ns/tests/nstest.c:194:3
#4 ns_test_end lib/ns/tests/nstest.c:337:2
#5 _teardown lib/ns/tests/notify_test.c:59:2
#6 <null> <null>
#7 __libc_start_main <null>
Mutex M2 previously acquired by the same thread here:
#0 pthread_mutex_lock <null>
#1 nm_destroy lib/isc/netmgr/netmgr.c:171:2
#2 isc_nm_detach lib/isc/netmgr/netmgr.c:308:3
#3 cleanup_managers lib/ns/tests/nstest.c:194:3
#4 ns_test_end lib/ns/tests/nstest.c:337:2
#5 _teardown lib/ns/tests/notify_test.c:59:2
#6 <null> <null>
#7 __libc_start_main <null>
Thread T1 (running) created by main thread at:
#0 pthread_create <null>
#1 isc_thread_create lib/isc/pthreads/thread.c:75:8
#2 isc_nm_start lib/isc/netmgr/netmgr.c:149:3
#3 create_managers lib/ns/tests/nstest.c:231:7
#4 ns_test_begin lib/ns/tests/nstest.c:316:3
#5 _setup lib/ns/tests/notify_test.c:49:11
#6 <null> <null>
#7 __libc_start_main <null>
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_mutex_lock
Edited by Mark Andrews