Handle libuv calling epoll_ctl() after close().

TSAN errors are reported on epoll_ctl()/dup().  Add a lock around
uv_close() call and uv_accept() calls so that references to the
file descriptor being closed are cleaned up before accept()/dup()
return the same descriptor.
75 jobs for !4185 with 2161-threadsanitizer-data-race-in-dup in 24 minutes and 1 second (queued for 32 seconds)
detached
Status Job ID Name Coverage
  Autoconf
passed #1180990
amd64 linux
autoreconf

00:00:16

 
  Precheck
passed #1180992
amd64 linux
clang-format

00:00:16

passed #1180993
amd64 linux
coccinelle

00:03:09

passed #1181067
linux amd64
danger

00:00:13

passed #1180991
amd64 linux
misc

00:00:10

passed #1180995
amd64 linux
tarball-create

00:01:21

failed #1180994
amd64 linux
danger

00:00:12

 
  Build
passed #1181008
amd64 linux
clang:asan

00:02:01

passed #1181012
amd64 linux
clang:buster:amd64

00:00:53

passed #1181015
amd64 libvirt
clang:freebsd11:amd64

00:01:06

passed #1181016
amd64 libvirt
clang:freebsd12:amd64

00:01:14

passed #1181017
amd64 libvirt
clang:openbsd:amd64

00:02:31

passed #1181010
amd64 linux
clang:tsan

00:01:12

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

00:00:46

passed #1181007
amd64 linux
gcc:asan

00:01:41

passed #1181000
amd64 linux
gcc:buster:amd64

00:00:45

passed #1180997
amd64 linux
gcc:centos7:amd64

00:00:41

passed #1180998
amd64 linux
gcc:centos8:amd64

00:00:45

passed #1181006
amd64 linux
gcc:focal:amd64

00:00:48

passed #1181011
amd64 linux
gcc:mutexatomics

00:00:53

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

00:00:50

passed #1181001
amd64 linux
gcc:sid:amd64

00:01:00

passed #1181003
i386 linux
gcc:sid:i386

00:00:50

passed #1181013
amd64 linux
gcc:softhsm2.4

00:00:52

passed #1181014
amd64 linux
gcc:softhsm2.6

00:00:56

passed #1180999
amd64 linux
gcc:stretch:amd64

00:00:54

passed #1181009
amd64 linux
gcc:tsan

00:01:02

passed #1181004
amd64 linux
gcc:tumbleweed:amd64

00:00:47

passed #1181005
amd64 linux
gcc:xenial:amd64

00:00:48

passed #1181018
amd64 windows
msvc:windows:amd64

00:00:48

 
  Unit
passed #1181030
amd64 linux
unit:clang:asan

00:01:25

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

00:00:55

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

00:01:26

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

00:01:15

passed #1181032
amd64 linux
unit:clang:tsan

00:03:15

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

00:01:00

passed #1181029
amd64 linux
unit:gcc:asan

00:01:17

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

00:00:58

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

00:00:58

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

00:00:59

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

00:00:56

passed #1181033
amd64 linux
unit:gcc:mutexatomics

00:00:57

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

00:00:59

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

00:01:05

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

00:00:59

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

00:00:55

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

00:00:56

passed #1181031
amd64 linux
unit:gcc:tsan

00:04:03

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

00:00:54

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

00:00:58

 
  System
passed #1181050
amd64 linux
system:clang:asan

00:12:00

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

00:10:41

failed #1181057
amd64 libvirt
system:clang:freebsd11:amd64

00:10:16

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

00:10:17

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

00:13:32

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

00:11:49

passed #1181049
amd64 linux
system:gcc:asan

00:12:36

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

00:10:08

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

00:11:27

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

00:11:28

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

00:11:30

passed #1181053
amd64 linux
system:gcc:mutexatomics

00:10:25

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

00:10:21

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

00:10:34

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

00:10:09

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

00:11:02

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

00:10:18

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

00:14:09

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

00:10:17

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

00:10:31

 
  Docs
passed #1181059
amd64 linux
docs

00:00:34

 
  Postcheck
passed #1181063
amd64 linux
cppcheck

00:00:45

passed #1181060
amd64 linux
flake8

00:00:18

passed #1181061
amd64 linux
pylint

00:00:21

passed #1181062
amd64 linux
scan-build

00:03:55

 
Name Stage Failure
failed
system:gcc:tsan System
E:rpzrecurse:2020-09-25T03:35:49+0000
FAIL rpzrecurse (exit status: 1)

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

Uploading artifacts as "archive" to coordinator... ok
id=1181051 responseStatus=201 Created token=DxKH4fsY
ERROR: Job failed: exit code 1
failed
system:clang:tsan System
E:shutdown:2020-09-25T03:45:52+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 2906 files

Uploading artifacts as "archive" to coordinator... ok
id=1181052 responseStatus=201 Created token=LUJ-MpCM
ERROR: Job failed: exit code 1
failed
system:clang:freebsd11:amd64 System
E:rpz:2020-09-25T03:32:19+0000
FAIL rpz (exit status: 1)

Uploading artifacts for failed job
Uploading artifacts...
Runtime platform
arch=amd64 os=freebsd pid=48612 revision=86ad88ea version=13.3.0
untracked: found 1566 files

Uploading artifacts as "archive" to coordinator... ok
id=1181057 responseStatus=201 Created token=_DzXcmS2
ERROR: Job failed: exit status 1