From: Evan Hunt Date: Mon, 9 Nov 2020 20:33:37 +0000 (-0800) Subject: address some possible shutdown races in xfrin X-Git-Tag: v9.16.11~17^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f6f0e26ab401c38ca67559f23fc8129d5bcc037;p=thirdparty%2Fbind9.git address some possible shutdown races in xfrin 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. --- diff --git a/lib/isc/netmgr/tcpdns.c b/lib/isc/netmgr/tcpdns.c index b06d56415da..aa2003ea795 100644 --- a/lib/isc/netmgr/tcpdns.c +++ b/lib/isc/netmgr/tcpdns.c @@ -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); + } } /*