From 55bf37d57da1a9b6acf4e6be434cf5972ce2425d Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Thu, 8 May 2014 16:43:01 -0600 Subject: [PATCH] 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. --- src/FwdState.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); } -- 2.47.3