From: Alex Rousskov Date: Thu, 8 May 2014 22:43:01 +0000 (-0600) Subject: Temporary fix for segmentation faults in FwdState::serverClosed. X-Git-Tag: SQUID_3_5_0_1~241 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55bf37d57da1a9b6acf4e6be434cf5972ce2425d;p=thirdparty%2Fsquid.git Temporary fix for segmentation faults in FwdState::serverClosed. 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. --- diff --git a/src/FwdState.cc b/src/FwdState.cc index 1738566448..1fd52ade58 100644 --- a/src/FwdState.cc +++ b/src/FwdState.cc @@ -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(); }