]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Temporary fix for segmentation faults in FwdState::serverClosed.
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 8 May 2014 22:43:01 +0000 (16:43 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 8 May 2014 22:43:01 +0000 (16:43 -0600)
r13388 (cache_peer standby=N) moved noteUses() call from Comm to FwdState, to
avoid exposing Comm to pconn pools. Unfortunately, the closing handler does
not get a valid FD value when the closing callback shares the Connection
object with the code that called conn->close(). It gets -1. The FD of the
FwdState connection itself is already -1 at that point, for similar reasons.
The code thinks it got a matching FD and calls noteUses() with an invalid FD.

This temporary workaround prevents noteUses() calls when FD is unknown.
Without those calls, pconn usage statistics will be wrong. A different
long-term solution is needed.

src/FwdState.cc

index 1738566448bda8e6edb5cf5ed9ef1532a8c33af0..1fd52ade5825a8eaa5f88f87b7907e9af7160e5d 100644 (file)
@@ -621,7 +621,7 @@ FwdState::serverClosed(int fd)
 {
     debugs(17, 2, "FD " << fd << " " << entry->url() << " after " <<
            fd_table[fd].pconn.uses << " requests");
-    if (serverConnection()->fd == fd) // should be, but not critical to assert
+    if (fd >= 0 && serverConnection()->fd == fd) // XXX: fd is often -1 here
         fwdPconnPool->noteUses(fd_table[fd].pconn.uses);
     retryOrBail();
 }