Merge branch '943-race-in-dispatcher-socket' into 'master'

Fix a possible race between udp dispatch and socket code

Closes #943

See merge request isc-projects/bind9!1992
This commit is contained in:
Evan Hunt 2019-05-31 15:31:58 -04:00
commit 28323f5ebf
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,7 @@
5243. [bug] Fix a possible race between dispatcher and socket
code in a high-load cold-cache resolver scenario.
[GL #943]
5242. [bug] In relaxed qname minimizatiom mode, fall back to
normal resolution when encountering a lame
delegation, and use _.domain/A queries rather

View file

@ -2596,15 +2596,16 @@ isc_socket_open(isc_socket_t *sock0) {
REQUIRE(VALID_SOCKET(sock));
REQUIRE(isc_refcount_current(&sock->references) == 1);
/*
* We don't need to retain the lock hereafter, since no one else has
* this socket.
*/
LOCK(&sock->lock);
REQUIRE(isc_refcount_current(&sock->references) >= 1);
REQUIRE(sock->fd == -1);
REQUIRE(sock->threadid == -1);
result = opensocket(sock->manager, sock, NULL);
UNLOCK(&sock->lock);
if (result != ISC_R_SUCCESS) {
sock->fd = -1;
} else {