Address lock-order-inversion

    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_rwlock_wrlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:52:4
    #2 zone_postload lib/dns/zone.c:5101:2
    #3 receive_secure_db lib/dns/zone.c:16206:11
    #4 dispatch lib/isc/task.c:1152:7
    #5 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_mutex_lock <null>
    #1 receive_secure_db lib/dns/zone.c:16204:2
    #2 dispatch lib/isc/task.c:1152:7
    #3 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M2 in thread T1:
    #0 pthread_mutex_lock <null>
    #1 get_raw_serial lib/dns/zone.c:2518:2
    #2 zone_gotwritehandle lib/dns/zone.c:2559:4
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 zone_gotwritehandle lib/dns/zone.c:2552:2
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_wrlock

(cherry picked from commit 10908766)
80 jobs for !4163 with 2157-threadsanitizer-lock-order-inversion-potential-deadlock-in-pthread_rwlock_wrlock-v9_16 in 18 minutes and 25 seconds (queued for 9 seconds)
latest detached
Status Job ID Name Coverage
  Precheck
passed #1174391
amd64 linux
autoreconf

00:00:14

passed #1174393
amd64 linux
clang-format

00:00:16

passed #1174394
amd64 linux
coccinelle

00:03:17

passed #1174549
linux amd64
danger

00:00:12

passed #1174392
amd64 linux
misc

00:00:14

failed #1174395
amd64 linux
danger

00:00:12

 
  Build
passed #1174409
amd64 linux
clang:asan

00:03:58

passed #1174413
amd64 linux
clang:buster:amd64

00:01:48

passed #1174416
amd64 libvirt
clang:freebsd11:amd64

00:01:55

passed #1174417
amd64 libvirt
clang:freebsd12:amd64

00:01:41

passed #1174418
amd64 libvirt
clang:openbsd:amd64

00:03:52

passed #1174411
amd64 linux
clang:tsan

00:02:20

passed #1174396
amd64 linux
gcc:alpine3.12:amd64

00:01:49

passed #1174408
amd64 linux
gcc:asan

00:03:10

passed #1174401
amd64 linux
gcc:buster:amd64

00:01:35

passed #1174397
amd64 linux
gcc:centos6:amd64

00:01:21

passed #1174398
amd64 linux
gcc:centos7:amd64

00:01:33

passed #1174399
amd64 linux
gcc:centos8:amd64

00:01:41

passed #1174407
amd64 linux
gcc:focal:amd64

00:01:29

passed #1174412
amd64 linux
gcc:mutexatomics

00:01:42

passed #1174403
amd64 linux
gcc:out-of-tree

00:01:30

passed #1174402
amd64 linux
gcc:sid:amd64

00:02:25

passed #1174404
i386 linux
gcc:sid:i386

00:01:38

passed #1174414
amd64 linux
gcc:softhsm2.4

00:01:30

passed #1174415
amd64 linux
gcc:softhsm2.6

00:01:37

passed #1174400
amd64 linux
gcc:stretch:amd64

00:01:50

passed #1174410
amd64 linux
gcc:tsan

00:02:03

passed #1174405
amd64 linux
gcc:tumbleweed:amd64

00:01:44

passed #1174406
amd64 linux
gcc:xenial:amd64

00:01:41

passed #1174420
amd64 windows
msvc:windows:amd64

00:00:55

passed #1174419
amd64 linux
nolibtool:sid:amd64

00:02:30

 
  Unit
passed #1174433
amd64 linux
unit:clang:asan

00:00:53

passed #1174437
amd64 linux
unit:clang:buster:amd64

00:00:34

passed #1174440
amd64 libvirt
unit:clang:freebsd11:amd64

00:01:06

passed #1174441
amd64 libvirt
unit:clang:freebsd12:amd64

00:01:06

passed #1174435
amd64 linux
unit:clang:tsan

00:01:28

passed #1174421
amd64 linux
unit:gcc:alpine3.12:amd64

00:00:47

passed #1174432
amd64 linux
unit:gcc:asan

00:00:49

passed #1174426
amd64 linux
unit:gcc:buster:amd64

00:00:36

passed #1174422
amd64 linux
unit:gcc:centos6:amd64

00:00:38

passed #1174423
amd64 linux
unit:gcc:centos7:amd64

00:00:37

passed #1174424
amd64 linux
unit:gcc:centos8:amd64

00:00:39

passed #1174431
amd64 linux
unit:gcc:focal:amd64

00:00:36

passed #1174436
amd64 linux
unit:gcc:mutexatomics

00:00:33

passed #1174427
amd64 linux
unit:gcc:sid:amd64

00:00:36

passed #1174428
i386 linux
unit:gcc:sid:i386

00:00:47

passed #1174438
amd64 linux
unit:gcc:softhsm2.4

00:00:38

passed #1174439
amd64 linux
unit:gcc:softhsm2.6

00:00:36

passed #1174425
amd64 linux
unit:gcc:stretch:amd64

00:00:35

passed #1174434
amd64 linux
unit:gcc:tsan

00:01:40

passed #1174429
amd64 linux
unit:gcc:tumbleweed:amd64

00:00:35

passed #1174430
amd64 linux
unit:gcc:xenial:amd64

00:00:39

passed #1174442
amd64 linux
unit:nolibtool:sid:amd64

00:00:48

 
  System
passed #1174455
amd64 linux
system:clang:asan

00:12:11

passed #1174459
amd64 linux
system:clang:buster:amd64

00:10:32

passed #1174462
amd64 libvirt
system:clang:freebsd11:amd64

00:10:37

passed #1174463
amd64 libvirt
system:clang:freebsd12:amd64

00:09:53

failed #1174457
amd64 linux allowed to fail
system:clang:tsan

00:14:39

passed #1174443
amd64 linux
system:gcc:alpine3.12:amd64

00:12:09

passed #1174454
amd64 linux
system:gcc:asan

00:12:54

passed #1174448
amd64 linux
system:gcc:buster:amd64

00:10:49

passed #1174444
amd64 linux
system:gcc:centos6:amd64

00:11:35

passed #1174445
amd64 linux
system:gcc:centos7:amd64

00:10:50

passed #1174446
amd64 linux
system:gcc:centos8:amd64

00:11:51

passed #1174453
amd64 linux
system:gcc:focal:amd64

00:11:14

passed #1174458
amd64 linux
system:gcc:mutexatomics

00:10:18

passed #1174449
amd64 linux
system:gcc:sid:amd64

00:10:50

passed #1174450
i386 linux
system:gcc:sid:i386

00:10:46

passed #1174460
amd64 linux
system:gcc:softhsm2.4

00:11:14

passed #1174461
amd64 linux
system:gcc:softhsm2.6

00:11:25

passed #1174447
amd64 linux
system:gcc:stretch:amd64

00:11:09

failed #1174456
amd64 linux allowed to fail
system:gcc:tsan

00:15:42

passed #1174451
amd64 linux
system:gcc:tumbleweed:amd64

00:11:07

passed #1174452
amd64 linux
system:gcc:xenial:amd64

00:10:23

passed #1174464
amd64 linux
system:nolibtool:sid:amd64

00:11:28

 
  Docs
passed #1174465
amd64 linux
docs

00:02:14

 
  Postcheck
passed #1174469
amd64 linux
cppcheck

00:00:20

passed #1174466
amd64 linux
flake8

00:00:18

passed #1174467
amd64 linux
pylint

00:00:21

passed #1174468
amd64 linux
scan-build

00:10:09

 
Name Stage Failure
failed
system:gcc:tsan System
make: *** [Makefile:491: test] Error 1
Running after_script
Running after script...
$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 10671 files

Uploading artifacts as "archive" to coordinator... ok
id=1174456 responseStatus=201 Created token=y9cYSLyA
ERROR: Job failed: exit code 1
failed
system:clang:tsan System
make: *** [Makefile:491: test] Error 1
Running after_script
Running after script...
$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 7494 files

Uploading artifacts as "archive" to coordinator... ok
id=1174457 responseStatus=201 Created token=Qq1nsxb6
ERROR: Job failed: exit code 1