------------------------------------------------------------ revno: 14065 revision-id: squid3@treenet.co.nz-20160630210912-1bejmj2ianm2n7oe parent: squid3@treenet.co.nz-20160630205330-5tgrycm42t5spw7q author: Christos Tsantilas committer: Amos Jeffries branch nick: 3.5 timestamp: Fri 2016-07-01 09:09:12 +1200 message: Assertion failed: Write.cc:38: "fd_table[conn->fd].flags.open" 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. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20160630210912-1bejmj2ianm2n7oe # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 577de02f78e726f2a37543210fe09dbf43b09756 # timestamp: 2016-06-30 21:11:16 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20160630205330-\ # 5tgrycm42t5spw7q # # Begin patch === modified file 'src/servers/FtpServer.cc' --- src/servers/FtpServer.cc 2016-06-15 22:08:16 +0000 +++ src/servers/FtpServer.cc 2016-06-30 21:09:12 +0000 @@ -218,12 +218,18 @@ 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 @@ 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 @@ 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;