From: Alex Rousskov Date: Tue, 15 Nov 2011 18:21:07 +0000 (-0700) Subject: Fix Comm::Write closing() assertion when retrying a failed UDP DNS query. X-Git-Tag: BumpSslServerFirst.take01~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8401d6fc3376c5094a8011a84ea821a3bb935c6e;p=thirdparty%2Fsquid.git Fix Comm::Write closing() assertion when retrying a failed UDP DNS query. When we receive a UDP DNS response with a truncation (TC) bit set, we retry using TCP. Since the retry trigger has nothing to do with the TCP connection, it is possible that the TCP connection is being closed when we are about to write to it: A call to our connection close callback has been scheduled but has not fired yet. We must check for and avoid such race conditions. --- diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 65a10cba87..4c3f7ab314 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -767,6 +767,10 @@ idnsDoSendQueryVC(nsvc *vc) if (vc->queue->contentSize() == 0) return; + // if retrying after a TC UDP response, our close handler cb may be pending + if (fd_table[vc->conn->fd].closing()) + return; + MemBuf *mb = vc->queue; vc->queue = new MemBuf;