]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
address some possible shutdown races in xfrin
authorEvan Hunt <each@isc.org>
Mon, 9 Nov 2020 20:33:37 +0000 (12:33 -0800)
committerOndřej Surý <ondrej@sury.org>
Wed, 9 Dec 2020 09:46:16 +0000 (10:46 +0100)
there were two failures during observed in testing, both occurring
when 'rndc halt' was run rather than 'rndc stop' - the latter dumps
zone contents to disk and presumably introduced enough delay to
prevent the races:

- a failure when the zone was shut down and called dns_xfrin_detach()
  before the xfrin had finished connecting; the connect timeout
  terminated without detaching its handle
- a failure when the tcpdns socket timer fired after the outerhandle
  had already been cleared.

this commit incidentally addresses a failure observed in mutexatomic
due to a variable having been initialized incorrectly.

lib/isc/netmgr/tcpdns.c

index b06d56415da3b5247a97c628db559ccf74d497bb..aa2003ea7956b5e3313b993d060c8e177681720c 100644 (file)
@@ -98,7 +98,9 @@ dnstcp_readtimeout(uv_timer_t *timer) {
        REQUIRE(sock->tid == isc_nm_tid());
 
        /* Close the TCP connection; its closure should fire ours. */
-       isc_nmhandle_detach(&sock->outerhandle);
+       if (sock->outerhandle != NULL) {
+               isc_nmhandle_detach(&sock->outerhandle);
+       }
 }
 
 /*