Fix task timing race in setnsec3param()

When setnsec3param() is schedule from zone_postload() there's no
guarantee that `zone->db` is not `NULL` yet.  Thus when the
setnsec3param() is called, we need to check for `zone->db` existence and
reschedule the task, because calling `rss_post()` on a zone with empty
`.db` ends up with no-op (the function just returns).

(cherry picked from commit 0127ba64)
77 jobs for !4913 with 2636-timing-race-in-setnsec3param-task-ondrej/cleanup-double-createinctx-constructors-v9_16 in 15 minutes and 29 seconds (queued for 26 seconds)
latest detached
Status Job ID Name Coverage
  Precheck
passed #1647820
amd64 linux
autoreconf

00:00:15

passed #1647822
amd64 linux
clang-format

00:00:18

passed #1647823
amd64 linux
coccinelle

00:03:35

failed #1647824
amd64 linux
danger

00:00:15

passed #1647821
amd64 linux
misc

00:00:11

 
  Build
failed #1647837
amd64 linux
clang:asan

00:02:47

failed #1647841
amd64 linux
clang:buster:amd64

00:01:13

failed #1647844
amd64 libvirt
clang:freebsd11:amd64

00:01:20

failed #1647845
amd64 libvirt
clang:freebsd12:amd64

00:01:18

failed #1647846
amd64 libvirt
clang:openbsd:amd64

00:02:38

failed #1647839
amd64 linux
clang:tsan

00:01:30

failed #1647825
amd64 linux
gcc:alpine3.13:amd64

00:01:15

failed #1647836
amd64 linux
gcc:asan

00:02:12

failed #1647829
amd64 linux
gcc:buster:amd64

00:00:57

failed #1647826
amd64 linux
gcc:centos7:amd64

00:01:01

failed #1647827
amd64 linux
gcc:centos8:amd64

00:01:04

failed #1647835
amd64 linux
gcc:focal:amd64

00:01:08

failed #1647840
amd64 linux
gcc:mutexatomics

00:01:10

failed #1647831
amd64 linux
gcc:out-of-tree

00:00:54

failed #1647830
amd64 linux
gcc:sid:amd64

00:01:24

failed #1647832
i386 linux
gcc:sid:i386

00:01:11

failed #1647842
amd64 linux
gcc:softhsm2.4

00:01:03

failed #1647843
amd64 linux
gcc:softhsm2.6

00:01:07

failed #1647828
amd64 linux
gcc:stretch:amd64

00:01:15

failed #1647838
amd64 linux
gcc:tsan

00:01:21

failed #1647833
amd64 linux
gcc:tumbleweed:amd64

00:01:06

failed #1647834
amd64 linux
gcc:xenial:amd64

00:01:15

failed #1647848
amd64 windows
msvc:windows:amd64

00:00:48

failed #1647847
amd64 linux
nolibtool:sid:amd64

00:00:57

 
  Unit
skipped #1647860
amd64 linux
unit:clang:asan
skipped #1647864
amd64 linux
unit:clang:buster:amd64
skipped #1647867
amd64 libvirt
unit:clang:freebsd11:amd64
skipped #1647868
amd64 libvirt
unit:clang:freebsd12:amd64
skipped #1647862
amd64 linux
unit:clang:tsan
skipped #1647849
amd64 linux
unit:gcc:alpine3.13:amd64
skipped #1647859
amd64 linux
unit:gcc:asan
skipped #1647853
amd64 linux
unit:gcc:buster:amd64
skipped #1647850
amd64 linux
unit:gcc:centos7:amd64
skipped #1647851
amd64 linux
unit:gcc:centos8:amd64
skipped #1647858
amd64 linux
unit:gcc:focal:amd64
skipped #1647863
amd64 linux
unit:gcc:mutexatomics
skipped #1647854
amd64 linux
unit:gcc:sid:amd64
skipped #1647855
i386 linux
unit:gcc:sid:i386
skipped #1647865
amd64 linux
unit:gcc:softhsm2.4
skipped #1647866
amd64 linux
unit:gcc:softhsm2.6
skipped #1647852
amd64 linux
unit:gcc:stretch:amd64
skipped #1647861
amd64 linux
unit:gcc:tsan
skipped #1647856
amd64 linux
unit:gcc:tumbleweed:amd64
skipped #1647857
amd64 linux
unit:gcc:xenial:amd64
skipped #1647869
amd64 linux
unit:nolibtool:sid:amd64
 
  System
skipped #1647881
amd64 linux
system:clang:asan
skipped #1647885
amd64 linux
system:clang:buster:amd64
skipped #1647888
amd64 libvirt
system:clang:freebsd11:amd64
skipped #1647889
amd64 libvirt
system:clang:freebsd12:amd64
skipped #1647883
amd64 linux
system:clang:tsan
skipped #1647870
amd64 linux
system:gcc:alpine3.13:amd64
skipped #1647880
amd64 linux
system:gcc:asan
skipped #1647874
amd64 linux
system:gcc:buster:amd64
skipped #1647871
amd64 linux
system:gcc:centos7:amd64
skipped #1647872
amd64 linux
system:gcc:centos8:amd64
skipped #1647879
amd64 linux
system:gcc:focal:amd64
skipped #1647884
amd64 linux
system:gcc:mutexatomics
skipped #1647875
amd64 linux
system:gcc:sid:amd64
skipped #1647876
i386 linux
system:gcc:sid:i386
skipped #1647886
amd64 linux
system:gcc:softhsm2.4
skipped #1647887
amd64 linux
system:gcc:softhsm2.6
skipped #1647873
amd64 linux
system:gcc:stretch:amd64
skipped #1647882
amd64 linux
system:gcc:tsan
skipped #1647877
amd64 linux
system:gcc:tumbleweed:amd64
skipped #1647878
amd64 linux
system:gcc:xenial:amd64
skipped #1647890
amd64 linux
system:nolibtool:sid:amd64
 
  Docs
failed #1647891
amd64 linux
docs

00:01:27

 
  Postcheck
passed #1647895
amd64 linux
cppcheck

00:00:21

passed #1647892
amd64 linux
flake8

00:00:21

skipped #1647896
amd64 linux
gcov
passed #1647893
amd64 linux
pylint

00:00:25

passed #1647894
amd64 linux
scan-build

00:07:46

 
Name Stage Failure
failed
clang:asan Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:asan Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
docs Docs
           isc_timermgr_create
cc1: all warnings being treated as errors
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: *** [Makefile:351: client.lo] Error 1
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
clang:tsan Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:tsan Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:softhsm2.6 Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:mutexatomics Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
nolibtool:sid:amd64 Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:focal:amd64 Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:xenial:amd64 Build
Makefile:84: recipe for target 'subdirs' failed
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make[1]: *** [subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
Makefile:89: recipe for target 'subdirs' failed
make: *** [subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:tumbleweed:amd64 Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:sid:i386 Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:sid:amd64 Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:out-of-tree Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/workspace/lib/dns'
make[1]: Leaving directory '/builds/isc-projects/bind9/workspace/lib'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
clang:openbsd:amd64 Build
Errors while building
*** Error 1 in target 'subdirs', line 89 of Makefile (continuing)
`all' not remade because of errors.
Errors while building
*** Error 1 in target 'subdirs', line 94 of Makefile (continuing)
Error target(s) unaccounted for: subdirs testdirs all
`all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit status 1
failed
clang:freebsd12:amd64 Build
libtool: compile:  cc -include /builds/isc-projects/bind9/config.h -I/builds/isc-projects/bind9 -I../.. -I. -I../../lib/dns -Iinclude -I/builds/isc-projects/bind9/lib/dns/include -I../../lib/dns/include -I/builds/isc-projects/bind9/lib/isc/include -I../../lib/isc -I../../lib/isc/include -I../../lib/isc/unix/include -I../../lib/isc/pthreads/include -I/usr/local/include -I/usr/include -I/usr/include -I/usr/local/include/google -I/usr/local/include -I/usr/local/include/json-c -I/usr/local/include/libxml2 -I /usr/local/include -I/usr/local/include -DGSSAPI -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra -pthread -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -Wno-missing-field-initializers -fno-strict-aliasing -Wshadow -Werror -c rdata.c  -fPIC -DPIC -o .libs/rdata.o
*** [subdirs] Error code 1

make[1]: stopped in /builds/isc-projects/bind9/lib
*** [subdirs] Error code 1

make: stopped in /builds/isc-projects/bind9
Cleaning up file based variables
ERROR: Job failed: exit status 1
failed
gcc:stretch:amd64 Build
make[1]: *** [subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
Makefile:84: recipe for target 'subdirs' failed
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
Makefile:89: recipe for target 'subdirs' failed
make: *** [subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
clang:freebsd11:amd64 Build
libtool: compile:  cc -include /builds/isc-projects/bind9/config.h -I/builds/isc-projects/bind9 -I../.. -I. -I../../lib/dns -Iinclude -I/builds/isc-projects/bind9/lib/dns/include -I../../lib/dns/include -I/builds/isc-projects/bind9/lib/isc/include -I../../lib/isc -I../../lib/isc/include -I../../lib/isc/unix/include -I../../lib/isc/pthreads/include -I/usr/include -I/usr/include -I/usr/local/include -I/usr/local/include/json-c -I/usr/local/include/libxml2 -I /usr/local/include -I/usr/local/include -DGSSAPI -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra -pthread -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -Wno-missing-field-initializers -fno-strict-aliasing -Wshadow -Werror -c rdata.c  -fPIC -DPIC -o .libs/rdata.o
*** [subdirs] Error code 1

make[1]: stopped in /builds/isc-projects/bind9/lib
*** [subdirs] Error code 1

make: stopped in /builds/isc-projects/bind9
Cleaning up file based variables
ERROR: Job failed: exit status 1
failed
gcc:alpine3.13:amd64 Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
clang:buster:amd64 Build
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:buster:amd64 Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:centos8:amd64 Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:softhsm2.4 Build
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/builds/isc-projects/bind9/lib/dns'
make[1]: Leaving directory '/builds/isc-projects/bind9/lib'
make[1]: *** [Makefile:84: subdirs] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:89: subdirs] Error 1
make: Target 'all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
gcc:centos7:amd64 Build
make[2]: Target `all' not remade because of errors.
make[2]: Leaving directory `/builds/isc-projects/bind9/lib/dns'
make[1]: Leaving directory `/builds/isc-projects/bind9/lib'
make[1]: *** [subdirs] Error 1
make[1]: Target `all' not remade because of errors.
make: *** [subdirs] Error 1
make: Target `all' not remade because of errors.
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
danger Precheck
 * branch            ondrej/cleanup-double-createinctx-constructors-v9_16 -> FETCH_HEAD



Failing the build, there is 1 fail.
Feedback: https://gitlab.isc.org/isc-projects/bind9/merge_requests/4913#note_207611

Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
msvc:windows:amd64 Build
         ..\..\..\Build\Release\libdns.dll : fatal error LNK1120: 3 unresolved externals [C:\builds\isc-projects\bind9\lib\dns\win32\libdns.vcxproj]

0 Warning(s)
4 Error(s)

Time Elapsed 00:00:23.73
Cleaning up file based variables
Unsupported run stage "cleanup_file_variables"
ERROR: Job failed: exit status 1