]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid comm_read "!fd_table[fd].closing()" assertion after adaptation ACL check
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 3 Dec 2010 23:04:01 +0000 (16:04 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 3 Dec 2010 23:04:01 +0000 (16:04 -0700)
The assertion was hit if Server fd was closed while we were checking
adaptation ACLs, and we have not been notified of the closure yet (because the
Adaptation::AccessCheck callback is not async while closure notification is).

src/http.cc

index fc2dddb3f98f297cd8e04c21cfd9ecc08894ee38..7bb69d10e71cca9ba89fd950d9d9688089448ea8 100644 (file)
@@ -1012,6 +1012,13 @@ HttpStateData::persistentConnStatus() const
     if (eof) // already reached EOF
         return COMPLETE_NONPERSISTENT_MSG;
 
+    /* If server fd is closing (but we have not been notified yet), stop Comm
+       I/O to avoid assertions. TODO: Change Comm API to handle callers that
+       want more I/O after async closing (usually initiated by others). */
+    // XXX: add canReceive or s/canSend/canTalkToServer/
+    if (!canSend(fd))
+        return COMPLETE_NONPERSISTENT_MSG;
+
     /** \par
      * In chunked response we do not know the content length but we are absolutely
      * sure about the end of response, so we are calling the statusIfComplete to