]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Assertion failed: Write.cc:38: "fd_table[conn->fd].flags.open"
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Thu, 30 Jun 2016 21:09:12 +0000 (09:09 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 30 Jun 2016 21:09:12 +0000 (09:09 +1200)
The Ftp::Server::stopWaitingForOrigin() notification may come after
Ftp::Server (or an external force) has started closing the control
connection but before the Ftp::Server job became unreachable for
notifications. Writing a response in this state leads to assertions.

Other, currently unknown paths may lead to the same write-after-close
problems. This change protects all asynchronous notification methods
(except the connection closure handler itself) from exposing underlying
code to a closing control connection. This is very similar to checking
for ERR_CLOSING in Comm handlers.

This is a Measurement Factory project.

src/servers/FtpServer.cc

index 12df5efcc2825d375b3f07ef0f642b9cb058550f..952fbd07ebf4a8a12dfc3f3a99ea1aed4122f1f8 100644 (file)
@@ -218,12 +218,18 @@ Ftp::Server::shovelUploadData()
 void
 Ftp::Server::noteMoreBodySpaceAvailable(BodyPipe::Pointer)
 {
+    if (!isOpen()) // if we are closing, nothing to do
+        return;
+
     shovelUploadData();
 }
 
 void
 Ftp::Server::noteBodyConsumerAborted(BodyPipe::Pointer ptr)
 {
+    if (!isOpen()) // if we are closing, nothing to do
+        return;
+
     ConnStateData::noteBodyConsumerAborted(ptr);
     closeDataConnection();
 }
@@ -1712,6 +1718,9 @@ Ftp::Server::callException(const std::exception &e)
 void
 Ftp::Server::startWaitingForOrigin()
 {
+    if (!isOpen()) // if we are closing, nothing to do
+        return;
+
     debugs(33, 5, "waiting for Ftp::Client data transfer to end");
     waitingForOrigin = true;
 }
@@ -1722,6 +1731,9 @@ Ftp::Server::stopWaitingForOrigin(int originStatus)
     Must(waitingForOrigin);
     waitingForOrigin = false;
 
+    if (!isOpen()) // if we are closing, nothing to do
+        return;
+
     // if we have already decided how to respond, respond now
     if (delayedReply != NULL) {
         HttpReply::Pointer reply = delayedReply;