------------------------------------------------------------ revno: 13404 revision-id: rousskov@measurement-factory.com-20140508224301-p70drxbqn1ls45i8 parent: kinkie@squid-cache.org-20140508132808-bdfnm3f8n6ze60vz committer: Alex Rousskov branch nick: trunk timestamp: Thu 2014-05-08 16:43:01 -0600 message: 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. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: rousskov@measurement-factory.com-20140508224301-\ # p70drxbqn1ls45i8 # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 2f64015544e1640e60c8a6d1d3b4bb163e868a95 # timestamp: 2014-05-08 22:53:58 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: kinkie@squid-cache.org-20140508132808-\ # bdfnm3f8n6ze60vz # # Begin patch === modified file 'src/FwdState.cc' --- src/FwdState.cc 2014-05-07 14:40:05 +0000 +++ src/FwdState.cc 2014-05-08 22:43:01 +0000 @@ -621,7 +621,7 @@ { 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(); }