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
74 jobs for !4158 with 2157-threadsanitizer-lock-order-inversion-potential-deadlock-in-pthread_rwlock_wrlock in 17 minutes and 21 seconds (queued for 8 seconds)
latest detached
Status Job ID Name Coverage
  Autoconf
passed #1174156
amd64 linux
autoreconf

00:00:18

 
  Precheck
passed #1174158
amd64 linux
clang-format

00:00:15

passed #1174159
amd64 linux
coccinelle

00:03:24

passed #1174160
amd64 linux
danger

00:00:11

passed #1174157
amd64 linux
misc

00:00:12

passed #1174161
amd64 linux
tarball-create

00:01:57

 
  Build
passed #1174174
amd64 linux
clang:asan

00:02:20

passed #1174178
amd64 linux
clang:buster:amd64

00:01:06

passed #1174181
amd64 libvirt
clang:freebsd11:amd64

00:01:31

passed #1174182
amd64 libvirt
clang:freebsd12:amd64

00:01:06

passed #1174183
amd64 libvirt
clang:openbsd:amd64

00:02:31

passed #1174176
amd64 linux
clang:tsan

00:01:20

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

00:00:56

passed #1174173
amd64 linux
gcc:asan

00:02:01

passed #1174166
amd64 linux
gcc:buster:amd64

00:00:59

passed #1174163
amd64 linux
gcc:centos7:amd64

00:00:49

passed #1174164
amd64 linux
gcc:centos8:amd64

00:01:00

passed #1174172
amd64 linux
gcc:focal:amd64

00:01:03

passed #1174177
amd64 linux
gcc:mutexatomics

00:00:51

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

00:01:05

passed #1174167
amd64 linux
gcc:sid:amd64

00:01:26

passed #1174169
i386 linux
gcc:sid:i386

00:01:05

passed #1174179
amd64 linux
gcc:softhsm2.4

00:00:59

passed #1174180
amd64 linux
gcc:softhsm2.6

00:00:47

passed #1174165
amd64 linux
gcc:stretch:amd64

00:01:06

passed #1174175
amd64 linux
gcc:tsan

00:01:27

passed #1174170
amd64 linux
gcc:tumbleweed:amd64

00:01:04

passed #1174171
amd64 linux
gcc:xenial:amd64

00:00:51

passed #1174184
amd64 windows
msvc:windows:amd64

00:00:43

 
  Unit
passed #1174196
amd64 linux
unit:clang:asan

00:01:09

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

00:00:57

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

00:01:28

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

00:01:22

passed #1174198
amd64 linux
unit:clang:tsan

00:03:12

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

00:01:02

passed #1174195
amd64 linux
unit:gcc:asan

00:01:13

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

00:01:02

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

00:00:55

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

00:00:58

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

00:00:58

passed #1174199
amd64 linux
unit:gcc:mutexatomics

00:00:59

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

00:00:59

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

00:01:04

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

00:00:55

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

00:00:59

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

00:01:01

passed #1174197
amd64 linux
unit:gcc:tsan

00:03:42

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

00:01:00

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

00:01:02

 
  System
passed #1174216
amd64 linux
system:clang:asan

00:12:44

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

00:10:42

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

00:10:50

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

00:10:36

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

00:14:52

failed #1174205
amd64 linux
system:gcc:alpine3.12:amd64

00:12:35

passed #1174215
amd64 linux
system:gcc:asan

00:12:26

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

00:10:40

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

00:11:39

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

00:11:45

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

00:11:12

passed #1174219
amd64 linux
system:gcc:mutexatomics

00:11:53

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

00:10:49

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

00:11:38

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

00:11:29

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

00:12:36

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

00:11:27

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

00:14:36

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

00:11:02

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

00:10:34

 
  Docs
passed #1174225
amd64 linux
docs

00:00:36

 
  Postcheck
passed #1174229
amd64 linux
cppcheck

00:00:43

passed #1174226
amd64 linux
flake8

00:00:19

passed #1174227
amd64 linux
pylint

00:00:24

passed #1174228
amd64 linux
scan-build

00:04:29

 
Name Stage Failure
failed
system:clang:tsan System
E:chain:2020-09-22T11:59:56+0000
FAIL chain (exit status: 1)

$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 10766 files

Uploading artifacts as "archive" to coordinator... ok
id=1174218 responseStatus=201 Created token=kjnxy25z
ERROR: Job failed: exit code 1
failed
system:gcc:tsan System
E:shutdown:2020-09-22T12:00:23+0000
FAIL shutdown (exit status: 1)

$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 10586 files

Uploading artifacts as "archive" to coordinator... ok
id=1174217 responseStatus=201 Created token=GxuVbELE
ERROR: Job failed: exit code 1
failed
system:gcc:alpine3.12:amd64 System
R:rpzrecurse:FAIL
E:rpzrecurse:2020-09-22T11:48:47+0000
FAIL rpzrecurse (exit status: 1)

Uploading artifacts for failed job
Uploading artifacts...
untracked: found 2910 files

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