]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix Comm::Write closing() assertion when retrying a failed UDP DNS query.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 15 Nov 2011 18:21:07 +0000 (11:21 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 15 Nov 2011 18:21:07 +0000 (11:21 -0700)
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.

src/dns_internal.cc

index 65a10cba873eb0c40512828482f7e22a9acf6e1a..4c3f7ab314c18a1a87bae5f1c19ca8d83d39335f 100644 (file)
@@ -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;