]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid !closing assertions when helpers call comm_read [during reconfigure].
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 19 May 2013 02:32:10 +0000 (20:32 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 19 May 2013 02:32:10 +0000 (20:32 -0600)
While helper reading code does check for COMM_ERR_CLOSING, it is not sufficient
because helperReturnBuffer() called by the reading code may notice the helper
shutdown flag (set earlier by reconfigure) and start closing the connection
underneath the reading code feet.

src/helper.cc

index b020a2c1423236b60ee3e6afd17ddb0c810e5c45..3f603caf1e3f768bec852a081fd701accd1ca80f 100644 (file)
@@ -36,6 +36,7 @@
 #include "comm/Connection.h"
 #include "comm/Write.h"
 #include "fd.h"
+#include "fde.h"
 #include "format/Quoting.h"
 #include "helper.h"
 #include "Mem.h"
@@ -940,7 +941,7 @@ helperHandleRead(const Comm::ConnectionPointer &conn, char *buf, size_t len, com
         helperReturnBuffer(i, srv, hlp, msg, t);
     }
 
-    if (Comm::IsConnOpen(srv->readPipe)) {
+    if (Comm::IsConnOpen(srv->readPipe) && !fd_table[srv->readPipe->fd].closing()) {
         int spaceSize = srv->rbuf_sz - srv->roffset - 1;
         assert(spaceSize >= 0);
 
@@ -1044,7 +1045,7 @@ helperStatefulHandleRead(const Comm::ConnectionPointer &conn, char *buf, size_t
             helperStatefulReleaseServer(srv);
     }
 
-    if (Comm::IsConnOpen(srv->readPipe)) {
+    if (Comm::IsConnOpen(srv->readPipe) && !fd_table[srv->readPipe->fd].closing()) {
         int spaceSize = srv->rbuf_sz - srv->roffset - 1;
         assert(spaceSize >= 0);