It appears that you can't change what you are polling for while connecting.

    WARNING: ThreadSanitizer: data race
    Read of size 8 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 epoll_ctl <null>
    #1 watch_fd lib/isc/unix/socket.c:704:8
    #2 wakeup_socket lib/isc/unix/socket.c:897:11
    #3 process_ctlfd lib/isc/unix/socket.c:3362:3
    #4 process_fds lib/isc/unix/socket.c:3275:10
    #5 netthread lib/isc/unix/socket.c:3516:10

    Previous write of size 8 at 0x000000000001 by thread T2 (mutexes: write M2):
    #0 connect <null>
    #1 isc_socket_connect lib/isc/unix/socket.c:4737:7
    #2 resquery_send lib/dns/resolver.c:2892:13
    #3 fctx_query lib/dns/resolver.c:2202:12
    #4 fctx_try lib/dns/resolver.c:4300:11
    #5 resquery_connected lib/dns/resolver.c:3130:4
    #6 dispatch lib/isc/task.c:1152:7
    #7 run lib/isc/task.c:1344:2

    Location is file descriptor 513 created by thread T2 at:
    #0 connect <null>
    #1 isc_socket_connect lib/isc/unix/socket.c:4737:7
    #2 resquery_send lib/dns/resolver.c:2892:13
    #3 fctx_query lib/dns/resolver.c:2202:12
    #4 fctx_try lib/dns/resolver.c:4300:11
    #5 resquery_connected lib/dns/resolver.c:3130:4
    #6 dispatch lib/isc/task.c:1152:7
    #7 run lib/isc/task.c:1344:2

    Mutex M1 (0x000000000016) created at:
    #0 pthread_mutex_init <null>
    #1 isc__mutex_init lib/isc/pthreads/mutex.c:288:8
    #2 setup_thread lib/isc/unix/socket.c:3584:3
    #3 isc_socketmgr_create2 lib/isc/unix/socket.c:3825:3
    #4 create_managers bin/named/main.c:932:11
    #5 setup bin/named/main.c:1223:11
    #6 main bin/named/main.c:1523:2

    Mutex M2 is already destroyed.

    Thread T1 'isc-socket-1' (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_socketmgr_create2 lib/isc/unix/socket.c:3826:3
    #3 create_managers bin/named/main.c:932:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    Thread T2 (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: data race in epoll_ctl

(cherry picked from commit c37b251e)
79 jobs for !4172 with 2162-threadsanitizer-data-race-in-epoll_ctl-v9_16 in 18 minutes and 57 seconds (queued for 34 minutes and 1 second)
latest detached
Status Job ID Name Coverage
  Precheck
passed #1176871
amd64 linux
autoreconf

00:00:16

passed #1176873
amd64 linux
clang-format

00:00:18

passed #1176874
amd64 linux
coccinelle

00:03:10

passed #1176875
amd64 linux
danger

00:00:13

passed #1176872
amd64 linux
misc

00:00:11

 
  Build
passed #1176889
amd64 linux
clang:asan

00:04:03

passed #1176893
amd64 linux
clang:buster:amd64

00:01:59

passed #1176896
amd64 libvirt
clang:freebsd11:amd64

00:01:50

passed #1176897
amd64 libvirt
clang:freebsd12:amd64

00:01:43

passed #1176898
amd64 libvirt
clang:openbsd:amd64

00:04:03

passed #1176891
amd64 linux
clang:tsan

00:02:31

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

00:01:42

passed #1176888
amd64 linux
gcc:asan

00:03:30

passed #1176881
amd64 linux
gcc:buster:amd64

00:01:42

passed #1176877
amd64 linux
gcc:centos6:amd64

00:01:20

passed #1176878
amd64 linux
gcc:centos7:amd64

00:01:39

passed #1176879
amd64 linux
gcc:centos8:amd64

00:01:34

passed #1176887
amd64 linux
gcc:focal:amd64

00:01:44

passed #1176892
amd64 linux
gcc:mutexatomics

00:01:45

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

00:01:31

passed #1176882
amd64 linux
gcc:sid:amd64

00:02:02

passed #1176884
i386 linux
gcc:sid:i386

00:01:36

passed #1176894
amd64 linux
gcc:softhsm2.4

00:01:39

passed #1176895
amd64 linux
gcc:softhsm2.6

00:01:47

passed #1176880
amd64 linux
gcc:stretch:amd64

00:01:42

passed #1176890
amd64 linux
gcc:tsan

00:01:59

passed #1176885
amd64 linux
gcc:tumbleweed:amd64

00:01:36

passed #1176886
amd64 linux
gcc:xenial:amd64

00:01:45

passed #1176900
amd64 windows
msvc:windows:amd64

00:01:08

passed #1176899
amd64 linux
nolibtool:sid:amd64

00:02:11

 
  Unit
passed #1176913
amd64 linux
unit:clang:asan

00:00:51

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

00:00:34

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

00:01:13

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

00:01:03

passed #1176915
amd64 linux
unit:clang:tsan

00:01:28

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

00:00:48

passed #1176912
amd64 linux
unit:gcc:asan

00:00:49

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

00:00:37

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

00:00:39

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

00:00:36

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

00:00:37

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

00:00:37

passed #1176916
amd64 linux
unit:gcc:mutexatomics

00:00:34

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

00:00:36

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

00:00:46

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

00:00:35

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

00:00:38

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

00:00:34

passed #1176914
amd64 linux
unit:gcc:tsan

00:01:55

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

00:00:34

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

00:00:36

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

00:00:50

 
  System
passed #1176935
amd64 linux
system:clang:asan

00:12:09

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

00:10:01

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

00:10:34

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

00:09:55

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

00:14:08

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

00:11:45

passed #1176934
amd64 linux
system:gcc:asan

00:12:35

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

00:11:12

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

00:10:52

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

00:10:06

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

00:10:50

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

00:10:43

passed #1176938
amd64 linux
system:gcc:mutexatomics

00:09:53

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

00:10:18

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

00:10:21

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

00:11:05

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

00:10:50

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

00:11:05

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

00:14:25

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

00:10:19

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

00:10:07

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

00:11:16

 
  Docs
passed #1176945
amd64 linux
docs

00:01:56

 
  Postcheck
passed #1176949
amd64 linux
cppcheck

00:00:20

passed #1176946
amd64 linux
flake8

00:00:17

passed #1176947
amd64 linux
pylint

00:00:20

passed #1176948
amd64 linux
scan-build

00:08:37

 
Name Stage Failure
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 1470 files

Uploading artifacts as "archive" to coordinator... ok
id=1176937 responseStatus=201 Created token=nwUsgypU
ERROR: Job failed: exit code 1
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 1394 files

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